PDA

View Full Version : Conditional For <if script =="script">


Xplorer4x4
03-20-2007, 10:02 AM
Ok can some one show me the if conditional for showing something only on showthread.php and forumdisplay.php

<if this_script == showthread.php AND forumdisplay.php>code</if>

That didn't look write but looked close, if some one could show me the correct version it would be very helpful. :)

Dismounted
03-20-2007, 10:11 AM
THIS_SCRIPT == 'showthread'
THIS_SCRIPT == 'forumdisplay'

TheMilkCarton
03-20-2007, 10:12 AM
<if condition="THIS_SCRIPT == 'forumdisplay' OR THIS_SCRIPT == 'showthread'">

AND won't work. I think that's right.. not too much of a coder. :)

nvm... I think AND is what you want if you're excluding all pages but those scripts. I think??

Xplorer4x4
03-20-2007, 10:25 AM
THIS_SCRIPT == 'showthread'
THIS_SCRIPT == 'forumdisplay'

your on a role today for helping me! Thanks alot both of you.

Kirk Y
03-21-2007, 04:09 AM
<if condition="THIS_SCRIPT == 'forumdisplay' OR THIS_SCRIPT == 'showthread'">AND won't work. I think that's right.. not too much of a coder. :)

nvm... I think AND is what you want if you're excluding all pages but those scripts. I think??

It'd be impossible to have two different values for THIS_SCRIPT -- it would be contradictory - and would always return false. (If this animal is a Fish and Ferret; return.) The correct operator would be OR. :p

<if condition="THIS_SCRIPT == 'forumdisplay'">
Only Show this if we're looking at Forumdisplay.</if>

<if condition="THIS_SCRIPT != 'forumdisplay'">
Only Show this if we're not looking at Forumdisplay.</if>

TheMilkCarton
03-21-2007, 06:36 AM
Yeah, sorry.. I was right the first time I guess. :) But I thought you could use "AND" if you also used "!==" such as <if condition="THIS_SCRIPT !== 'forumdisplay' AND THIS_SCRIPT !== 'showthread'"> Wouldn't that show code in everything but forumdisplay and showthread? Or is it still "OR"?

Dismounted
03-21-2007, 06:49 AM
Yeah, sorry.. I was right the first time I guess. :) But I thought you could use "AND" if you also used "!==" such as <if condition="THIS_SCRIPT !== 'forumdisplay' AND THIS_SCRIPT !== 'showthread'"> Wouldn't that show code in everything but forumdisplay and showthread? Or is it still "OR"?
That would shown everywhere execpt forumdisplay and showthead. Also, !== (or ===) is only used when comparing types. != (or ==) should be used in any other case.

Kirk Y
03-21-2007, 03:31 PM
What Dismounted said. :p