curriertech
01-25-2013, 06:21 PM
Hi,
I spent a bit of time trying to do this myself this morning, using bits and pieces of similar threads on here, but I can't get it working. What I want to do is define an array of forumids in a plugin, and reference the output variable in a conditional. Now, I've done this for non-conditional template use with success in the past but I read that you cannot use vb:raw in this context inside a conditional.
Here's the current plugin code using the global_state_check hook...
if (!in_array($foruminfo['forumid'], array(61,63,80,31,81,69,24,67,28,77,79,78,84)))
{
$show['not_sponsor'] = true;
}else{
$show['not_sponsor'] = false;
}
Assuming that's correct, how do I reference the variable in the conditional? $not_sponsor? not_sponsor? Also, if I'm not using vb:raw in the template, do I still have to pre-register the variable in the templates? I tried it with this code in the plugin...
vB_Template::preRegister('ad_navbar_below',array(' not_sponsor' => $not_sponsor));
vB_Template::preRegister('ad_showthread_firstpost_ start',array('not_sponsor' => $not_sponsor));
In the end all I'm trying to do is not show ads in certain forums, or threads within those forums, without maintaining the actual array in each ad template. Any advice/help is more than welcome.
Lynne gave me some direction in this thread on vb.com (https://www.vbulletin.com/forum/showthread.php/416016-forumid-array-in-plugin-for-use-in-template-conditional) but I'm still having trouble.
--------------- Added 1359144704 at 1359144704 ---------------
Nevermind, I got it working by changing the hook to global_start.
I spent a bit of time trying to do this myself this morning, using bits and pieces of similar threads on here, but I can't get it working. What I want to do is define an array of forumids in a plugin, and reference the output variable in a conditional. Now, I've done this for non-conditional template use with success in the past but I read that you cannot use vb:raw in this context inside a conditional.
Here's the current plugin code using the global_state_check hook...
if (!in_array($foruminfo['forumid'], array(61,63,80,31,81,69,24,67,28,77,79,78,84)))
{
$show['not_sponsor'] = true;
}else{
$show['not_sponsor'] = false;
}
Assuming that's correct, how do I reference the variable in the conditional? $not_sponsor? not_sponsor? Also, if I'm not using vb:raw in the template, do I still have to pre-register the variable in the templates? I tried it with this code in the plugin...
vB_Template::preRegister('ad_navbar_below',array(' not_sponsor' => $not_sponsor));
vB_Template::preRegister('ad_showthread_firstpost_ start',array('not_sponsor' => $not_sponsor));
In the end all I'm trying to do is not show ads in certain forums, or threads within those forums, without maintaining the actual array in each ad template. Any advice/help is more than welcome.
Lynne gave me some direction in this thread on vb.com (https://www.vbulletin.com/forum/showthread.php/416016-forumid-array-in-plugin-for-use-in-template-conditional) but I'm still having trouble.
--------------- Added 1359144704 at 1359144704 ---------------
Nevermind, I got it working by changing the hook to global_start.