PDA

View Full Version : How can I condition which thread belongs to which forum?


vexxy
03-16-2010, 07:01 AM
When I user visits a thread, I want to highlight the parent forum of the respective thread...what's the condition?

tnx in advance

edit: I found how can i condition if is a forum what forum belongs in the x parent forum with:

<vb:if condition="$foruminfo[forumid] == 'x' OR $foruminfo[parentid] == 'x'">

the problem is, if I visit a thread from that parent id, it acts wierd...it verifies the condition and the else branch...i'm puzzled

the forum structure is like this:

Forum A (parent)
- Forum B
-- Forum C

If I visit forum A, it's all good, if I visit forum B it's all good...forum C does not verify the condition (probably because can't verify the master parent condition). Any threads i visit from any of those forums, both verify and deny this condition...i don't get it.

Lynne
03-17-2010, 02:13 AM
I don't know of a variable that looks at all the parents of a forum. Whoops, scratch that! It looks like there is a string called parentlist which would have what you want. It' a string, so you'd have to convert it to an array in a plugin and then you can just use in_array to see if it is in there. I'd do a search in the files for "parentlist" and see if maybe it already gets turned into an array for you to use.

vexxy
03-17-2010, 07:50 AM
i have resolved this issue more elegantly..i think...you can include $foruminfo[forumid] in an array and check all the id's there...the problem is, you must enter all parents manually, but hey! :P

<vb:if condition="in_array($foruminfo[forumid], array(1,14,24,25,26,27))">

edit: while this thing works for any forumid from that array, if I visit any thread from these forums, it validates both if's, I don't understand why. ex...if I visit the thread "This is a thread" from any of the forums, both home and the forum button stay "selected"

<vb:if condition="in_array($foruminfo[forumid], array(1,14,24,25,26,27,19,20,21,22,23,13,15,61,17, 62,63))">
<li class="selected"><a class="navtab" href="http://www.forum.com/f1/">Software</a></li>
<vb:else />
<li><a class="navtab" href="http://www.forum.com/f1/">Software</a></li>
</vb:if>

vexxy
03-23-2010, 08:22 AM
now the only challenge I have is to test if a thread belongs to the x parent forum or its parent parent. Can I do this in some array..or is there a condition? I've noticed that the showthread doesn't have any variable linked to its parent forum

vexxy
03-27-2010, 10:25 AM
resolved the issue....i just conditioned it that on certain pages, will not be displayed ex ( AND THIS SCRIPT !='showthread')