Hi there, i have a tabulated css layout that needs a class assigning it as selected, I want to define this selected class by the parentID, or of the parentList contains X
Code:
<if condition="$foruminfo[parentlist] == X">class="selected"</if>
However since this checks for a match rather than a contains i am stuck as i am not sure how to check with an array i did have something liek this but to no avail.
Code:
<if condition="in_array('X', array($parentlist))">class="selected"</if>
update this code nearly works, but only seems to read the first integer in the array?!? Any help ?
Code:
<if condition="in_array(14,array($foruminfo[parentlist]))">
--------------- Added [DATE]1206992160[/DATE] at [TIME]1206992160[/TIME] ---------------
To answer my own question, $parentlist is a string not an array, so i need to explode this in to an array. However i can't do this inline as explode is not a valid php function for vb, instead i setup plugin.
plug-in > Hook Location

arse_templates
Code:
$parentarray= explode(',', $foruminfo[parentlist]);
Then i can perform the array conditional inline using this new global variable
Code:
<if condition="in_array(14, $parentarray)">class="selected"</if>
This doesn't actually evaluate in the template, but continue anyway, and all is well.
TA DA! Well i'm impressed anyway!