vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Conditionals problem combining with "==" works but "!=" doesn't (https://vborg.vbsupport.ru/showthread.php?t=184873)

L2V 07-10-2008 12:46 AM

Conditionals problem combining with "==" works but "!=" doesn't
 
I am working on some template modifications and have come across a problem on my 3.7.2 test board. I am trying to get something to show up in all areas of the forum except for a showthread page, blog page or social groups page.

Check out these following code samples and please tell me if I am doing something wrong...

Code:

<if condition="THIS_SCRIPT != 'showthread'">not showthread<br /></if>
<if condition="THIS_SCRIPT != 'blog'">not blog<br /></if>
<if condition="THIS_SCRIPT != 'group'">not group<br /></if>

Behaves correctly and as expected

Code:

<if condition="THIS_SCRIPT == 'index' OR THIS_SCRIPT == 'forumdisplay' OR THIS_SCRIPT == 'usercp' OR THIS_SCRIPT == 'private' OR THIS_SCRIPT == 'memberlist' OR THIS_SCRIPT == 'search' OR THIS_SCRIPT == 'faq'">if is script test<br /></if>
Behaves as expected. If the page is any of these scripts it

Code:

<if condition="THIS_SCRIPT != 'showthread' OR THIS_SCRIPT != 'blog' OR THIS_SCRIPT != 'group'">not conditionals combined<br /></if>
Doesn't work at all. The test text show up on every page.

Why? Is it supposed to behave this way? What am I doing wrong?:confused:

skhms 07-10-2008 01:06 AM

That last example will of course always return true.

THIS_SCRIPT will always be not equal to either showthread, blog or group.

Try using AND instead of OR.

/SK

Dismounted 07-10-2008 05:30 AM

Nice and compact is always good :).
Code:

<if condition="in_array(THIS_SCRIPT, array('index', 'forumdisplay', 'usercp', 'private', 'memberlist', 'search', 'faq'))">if is script test<br /></if>
Code:

<if condition="!in_array(THIS_SCRIPT, array('showthread', 'blog', 'group'))">not conditionals combined<br /></if>

L2V 07-10-2008 10:13 AM

Brilliant! Thanks so much to both of you!


All times are GMT. The time now is 11:36 AM.

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.01112 seconds
  • Memory Usage 1,715KB
  • 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
  • (5)bbcode_code_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