Hey Guys,
I have read a lot about using variables from plugins inside the FORUMDISPLAY template. But nothing really covers what I'm trying to do.
What I'm trying to do is create a conditional based on specific parent forumids - but using an array.
I can access the parentlist id's on a page using
Code:
{vb:raw $foruminfo[parentlist]}
The parentlist is equal to something like '690,610,-1' (current forumid,parent forumid,no parent).
Once I have that, I want to basically say, if 'parentlist' CONTAINS '610' then show this.
I know you can't do a CONTAINS conditional that way because vbulletin doesn't allow it, and the parenlist is just a string, not an array.
So I need to make a plugin to turn the parentlist into and array. Then register it for use in the FORUMDISPLAY template. For that I used
PHP Code:
$parentarray = explode(',', $foruminfo[parentlist]);
vB_Template::preRegister('FORUMDISPLAY', $parentarray);
The hook location for this plugin is set to parse_templates.
Now I want to say in my FORUMDISPLAY template. If $parentarray CONTAINS '610' then show this. For which is used:
Code:
<vb:if condition="in_array(610, parentarray)"><!-- It's working --></vb:if>
That doesn't validate in the template though, which is where I'm looking for some guidance.
I believe everything is working up to the conditional statement, and I'm not sure if I'm accessing the parentarray variable in the right way.
Any help would be appreciated.
Thanks,
hilaryl