PDA

View Full Version : [HELP] Coding Help.


mk craig 42
03-18-2009, 06:04 PM
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.

<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.

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.

RLShare
03-18-2009, 06:07 PM
You need quotes around 'Team A' and 'Team B' in the conditionals

mk craig 42
03-18-2009, 06:21 PM
Well thats sorted the error problem when i save it lol, but now the link isn't showing..

Lynne
03-18-2009, 06:56 PM
Can we see what the page source says where the link is supposed to be?

Also, I think you want to do this:
<if condition="$post['field10'] === 'Team A'">

mk craig 42
03-18-2009, 07:21 PM
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.

Lynne
03-18-2009, 07:28 PM
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.

mk craig 42
03-18-2009, 07:36 PM
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.