PDA

View Full Version : VB If Conditional not working in AD code?


mgunit2
05-10-2010, 05:36 PM
Hi All,

I'm trying to use the following conditional to stop an advertisement from showing in a specific forum:

<vb:if condition="$forumid != 18">
ad code here
</vb:if>

It doesn't break the forum or anything, but the ad still shows in that forum. Anything glaringly wrong with the code?

EDIT: To be more clear this is using the built in VB 4 ad code manager and trying to place it below the navbar. I am also checking one of their boxes (to not show it to a certain usergroup).

Boofo
05-10-2010, 08:43 PM
Try

<vb:if condition="$forumid != '18'"> with single quotes around the number.

And shouldn't that be this?

$foruminfo['forumid']

Lynne
05-10-2010, 08:57 PM
Actually, we can't guess at the variable name since we don't know what template it is. You need to use a variable that is registered for use in that template. Or, try $GLOBALS['forumid']

Boofo
05-10-2010, 09:46 PM
I stand corrected.

mgunit2
05-11-2010, 12:54 PM
Actually, we can't guess at the variable name since we don't know what template it is. You need to use a variable that is registered for use in that template. Or, try $GLOBALS['forumid']

Thanks, the $GLOBALS bit did exactly what I was trying to do.