PDA

View Full Version : Template Conditionals not working properly?


Skyrider
12-31-2012, 09:23 AM
I'm trying to use the "Show in one forum" conditional, but I can't get it to work what so ever.

Example:
<vb:if condition="$forum[forumid] == x">Show this if forum id is x</vb:if>

^ This code, trying to apply it to the newthread (forumhome) code:

With example:

<vb:if condition="$forum[forumid] == 35">TEST

<vb:else />

<vb:if condition="$show['newthreadlink']"><a href="{vb:raw $vboptions.vbforum_url}{vb:if "$vboptions['vbforum_url']", '/', ''}newthread.php?{vb:raw session.sessionurl}do=newthread&amp;f={vb:raw foruminfo.forumid}" rel="nofollow" class="newcontent_textcontrol" id="newthreadlink_top"><span>+</span> {vb:rawphrase post_new_thread}</a></vb:if>
<vb:if condition="$show['threadslist']"></vb:if>
<div class="threadpagenav">
{vb:raw pagenav}
<div id="threadpagestats" class="threadpagestats">{vb:rawphrase showing_threads_x_to_y_of_z, {vb:raw limitlower}, {vb:raw limitupper}, {vb:raw totalthreads}}</div>
</div>
</vb:if>

Now, the Forum ID is 35, as such I only want the text "TEST" to be visible in that section only at the "new thread" location. Just, it doesn't work.. When I replace the == with !=, it works. But it also affects every single section of which I don't want..

Am I doing something wrong, or does the code doesn't work properly?

kh99
12-31-2012, 12:56 PM
Which template are you putting that in? Try this:

<vb:if condition="$GLOBALS['forumid'] == 35">TEST

Skyrider
12-31-2012, 03:00 PM
^ This code, trying to apply it to the newthread (forumhome) code:
I mentioned forumhome, but I meant forumdisplay.

And thanks, that code seems to be working perfectly! Thank you.

When should "$forum" be applied then? I found it in the vb4 conditional list.

kh99
12-31-2012, 03:59 PM
When should "$forum" be applied then? I found it in the vb4 conditional list.

I'm not sure offhand. The reason it seems confusing is that there really aren't any rules for what to use where, it just depends on the template (or the hook location, for a plugin), and how the vb code is written in that script.