PDA

View Full Version : Conditonal Questions?


d3f
09-23-2004, 06:24 PM
I was just woundering if there was anyway to do a conditional for "Template is Forumhome" or "Template is not showthread" so I could add content that appears to everyone but make it only show up in my sidebar on certain templates/pages.

Thanks in advanced.

Dean C
09-23-2004, 08:34 PM
Questions about modifying vBulletin's default behaviour and asking about modifications in general, should be posted in General vBulletin Questions. Please read the forum descriptions more carefully in future. I've moved your thread there for you :)

Thanks,
- Dean

----------------

On topic you should be able to use <if condition="THIS_SCRIPT == 'showthread'"></if>

d3f
09-23-2004, 09:34 PM
Thanks dean, this works great but dosnt use the template name, it uses the "define('THIS_SCRIPT', 'index');" line from each file, is there anyway to use a conditonal based on if the template name, perhaps if you have Add Template Name in HTML Comments enabled? or would this require some sort of code edit.

Xenon
09-23-2004, 11:25 PM
i don't see what you are trying.

if you are editing the template, you should know which template you edit, and therefore a conditional in that template related to a template name would be useless, because it would be either always true or always false.

you can just use a conditional for checking which script is running, and that would be Deans way.

Or am i getting something totally wrong now?

d3f
09-24-2004, 12:39 AM
ok say I defined a template in global.php with something like

eval('$mytemplate = "' . fetch_template('mytemplate') . '";');

as a global template

now lets say somewhere I want to use

in forumhome and some other specific templates

<if condition="$bbuserinfo['usergroupid'] != 6">
$mytemplate
</if>

now in my header I want something like

<if conditon="templatepresent == mytemplate">
some other content assoiated with mytemplate but does not reside within it
</if>

I want to know if thats possible.

Milorad
09-24-2004, 07:56 AM
check THIS_SCRIPT, which is defined in each php file. index.php and showthread.php will have a different value for THIS_SCRIPT.

Xenon
09-24-2004, 12:13 PM
ah i think i got ya now.
But nope that's not possible, you have to use the THIS_SCRIPT constant for that.