Log in

View Full Version : Using conditionals to control banners based on forum


punchbowl
12-19-2006, 10:03 AM
:cross-eyed:

e.g. I've got 3 forums

1.general
2.adult
3.gambling

and want to insert specific advertising code under the navbar for each.

Something like this should work:

<if condition="$forum[forumid] == 1>general banner code
<else />
<if condition="$forum[forumid] == 2>adult banner code
<else />
<if condition="$forum[forumid] == 3>gambling banner code
</if>
[not real world code - probably use arrays]


but I'm not sure that $forum[forumid] is passed to newreply or individual threads e.g. if someone opens up a thread in the gambling forum will vb know what forum it's in automatically.

Cheers

:cross-eyed:

e.g. I've got 3 forums

1.general
2.adult
3.gambling

and want to insert specific advertising code under the navbar for each.

Something like this should work:

<if condition="$forum[forumid] == 1>general banner code
<else />
<if condition="$forum[forumid] == 2>adult banner code
<else />
<if condition="$forum[forumid] == 3>gambling banner code
</if>
[not real world code - probably use arrays]


but I'm not sure that $forum[forumid] is passed to newreply or individual threads e.g. if someone opens up a thread in the gambling forum will vb know what forum it's in automatically.YES with some exceptions see to do below

Cheers

You might want to try this! (replace forum numbers with your own and don't forget to include categories!)
<if condition="in_array($forumid, array(1,2,5,6,7,9))">
<div align="center">hello general people!</div>
<else />
<if condition="in_array($forumid, array(3,4))">
<div align="center">hello pervs!</div>
<else />
<if condition="in_array($forumid, array(10,11))">
<div align="center">hello gamblers!</div>
</if>
</if>
</if>

[just posted for the others trying to get their head round vb+conditionals]

To do:
index.php/newpost.php etc