PDA

View Full Version : $foruminfo variables in ad location templates?


curriertech
01-27-2013, 01:24 AM
I've added a column to the forum table and can reference the value in a conditional via $foruminfo[varname] in the forumdisplay template but what I really want to do is use it in the ad location templates. How can I get this to work? More info on what I've done is here: https://vborg.vbsupport.ru/showthread.php?t=294400

Lynne
01-27-2013, 03:09 AM
I don't believe you can use conditions in the Ad Manager.

curriertech
01-27-2013, 11:27 AM
I'm not using the ad manager, I'm using the ad location templates such as ad_navbar_below.

kh99
01-27-2013, 12:24 PM
I think the problem might be that $foruminfo isn't registered to the ad templates (as you mentioned in the other thread). To do that you'd use a plugin on hook parse_templates and code like:
global $foruminfo;
vB_Template::preRegister('template_name', array('hideads' => $foruminfo['hideads']));



(of course you'd use the actual termplate name). Then in the template you'd check $hideads.

curriertech
01-27-2013, 12:37 PM
Thanks Kevin, I was sure it was a matter of preregistering something but I couldn't for the life of me figure out which var and hook. This worked like a charm, thank you!

kh99
01-27-2013, 12:56 PM
Oh, I also meant to mention this: if $foruminfo is a global variable you might be able to do it without an extra plugin, like this:

<vb:if condition="$GLOBALS['foruminfo']['hideads']">

curriertech
01-27-2013, 12:58 PM
Oh, I also meant to mention this: if $foruminfo is a global variable you might be able to do it without an extra plugin, like this:

<vb:if condition="$GLOBALS['foruminfo']['hideads']">

I'll give this a shot, thank you. I did try with $GLOBALS but I had the syntax of the rest of it very, very wrong. :D

--------------- Added 1359295508 at 1359295508 ---------------

Works perfectly, thanks again Kevin!