Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 03-18-2009, 06:04 PM
mk craig 42 mk craig 42 is offline
 
Join Date: Feb 2009
Location: Bedford
Posts: 132
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default [HELP] Coding Help.

Well im trying to create a link that is dependent upon which "Team" you pick in "Edit Options" (done using the profile fields)

For example, if you pick "Team A" in your options then the link will go to /forums/teamA.php

And if you pick "Team B" iny our options then the link will go to /forums/teamB.php

Now i can't quite figure it out, since im no good at coding, but i will never just post on vb.org without trying myself.

Here is what i managed to come up with.

PHP Code:
<if condition="$post[field10] == Team A">
        <
div class="sidebar_menu"><a href="http://www.MYSITE.com/forum/TeamA.php">My Teams</a></div></if>

<if 
condition="$post[field10] == Team B">
        <
div class="sidebar_menu"><a href="http://www.MYSITE.com/forum/TeamB.php">My Teams</a></div></if> 
Now in my eyes, that should work, as i have 2 profile field options in a Single Selection Menu, one called "Team A" and the other called "Team B"
and if im not mistaken the code is set so that if field10 is Team B then the link should be /forums/TeamB.php

Any ideas please?
Here is what it comes up with when i try to save.

Code:
The following error occurred when attempting to evaluate this template:

Parse error:  syntax error, unexpected T_STRING in /home/oregami/public_html/forum/includes/adminfunctions_template.php(3929) : eval()'d code on line 139

This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.
Reply With Quote
  #2  
Old 03-18-2009, 06:07 PM
RLShare RLShare is offline
 
Join Date: Jun 2008
Posts: 499
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You need quotes around 'Team A' and 'Team B' in the conditionals
Reply With Quote
  #3  
Old 03-18-2009, 06:21 PM
mk craig 42 mk craig 42 is offline
 
Join Date: Feb 2009
Location: Bedford
Posts: 132
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well thats sorted the error problem when i save it lol, but now the link isn't showing..
Reply With Quote
  #4  
Old 03-18-2009, 06:56 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can we see what the page source says where the link is supposed to be?

Also, I think you want to do this:
HTML Code:
<if condition="$post['field10'] === 'Team A'">
Reply With Quote
  #5  
Old 03-18-2009, 07:21 PM
mk craig 42 mk craig 42 is offline
 
Join Date: Feb 2009
Location: Bedford
Posts: 132
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There is no page source as of yet, im currently testing it with the URL's as http://www.MYSITE.com/forum/TeamA.php

and checking to see if it works by putting my cursor over the link and seeing if it goes to /forum/TeamA.php when my user profile field option is set as Team A

But my problem now is, i have added the quotation marks around the field names 'Team A' and ' Team B' but now the link is not showing up on my navbar.
Reply With Quote
  #6  
Old 03-18-2009, 07:28 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It won't show up in your navbar if you use $post. That is not valid there. Use $bbuserinfo if it is for the person viewing the site.
Reply With Quote
  #7  
Old 03-18-2009, 07:36 PM
mk craig 42 mk craig 42 is offline
 
Join Date: Feb 2009
Location: Bedford
Posts: 132
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ahh, Thanks a lot - Worked like a charm

Really new to this coding business, so i don't know much, but i was half right eh.
At least i now know for future use, thank you for your help, it's appreciated.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:48 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04394 seconds
  • Memory Usage 2,224KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)bbcode_html
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete