PDA

View Full Version : Conditionals


Xtrigit
11-15-2010, 01:18 PM
I want to display an ad on the showthread.php page but show a different ad depending on what forums the user is browsing.

<vb:if condition="in_array($threadinfo['forumid'], array(1, 2, 3))">
Ad code
</vb:if>

I need something similar to the above but a different ad code for each forum (1,2,3)

thanks

Lynne
11-15-2010, 01:29 PM
Something like... ?
<vb:if condition="$threadinfo['forumid'] == 1">
ad for 1
<vb:elseif condition="$threadinfo['forumid'] == 2" />
ad for 2
<vb:elseif condition="$threadinfo['forumid'] == 3" />
ad for 3
</vb:if>

Xtrigit
11-15-2010, 01:58 PM
Awesome!

Now, what if I want to do the same but this time to certain forum groups?

I tried:

<vb:if condition="in_array($threadinfo['forumid'], array(1,2))">
ad code
<vb:elseif condition="in_array($threadinfo['forumid'], array(3,4))">
ad code
<vb:elseif condition="in_array($threadinfo['forumid'], array(5, 6))">
ad code
</vb:if>

But it didn't work.

Lynne
11-15-2010, 02:45 PM
How exactly didn't it work? Just saying "it didn't work" tells us nothing.

Xtrigit
11-15-2010, 03:36 PM
Thank you, Lynne!

As you can see, I forgot the slash "/" in the <vb:elseif tag.

Working great now (:

Lynne
11-15-2010, 05:34 PM
Ah yes, that / is very important! :)