vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Template Conditionals not working properly? (https://vborg.vbsupport.ru/showthread.php?t=293444)

Skyrider 12-31-2012 09:23 AM

Template Conditionals not working properly?
 
I'm trying to use the "Show in one forum" conditional, but I can't get it to work what so ever.

Example:
Code:

<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:

Code:

<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:

Code:

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

Skyrider 12-31-2012 03:00 PM

Quote:

^ 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

Quote:

Originally Posted by FF|Skyrider (Post 2393807)
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.


All times are GMT. The time now is 04:47 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01090 seconds
  • Memory Usage 1,719KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete