The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
I am attempting to write a conditional statement for the header template, in plain english it would be:
if ("script == showthread" and "User Logged On" and "Thread Age > 30 Days") OR (forum ID == 33) { ..output something } else if (no user logged on) { ..output something } Now my stab at this is: <if condition="in_array(THIS_SCRIPT, array(showthread)) AND $bbuserinfo['userid'] != 0 AND $threadinfo['dateline'] < (TIMENOW - 2419200) OR $forumid == 33"> ..output something <else /> <if condition="$bbuserinfo['userid'] == 0"> ..output something </if> </if> However this just doesnt seem to work right, and I can't see where |
|
#2
|
|||
|
|||
|
Code:
<if condition="((THIS_SCRIPT == 'showthread') AND ($show['member']) AND ($threadinfo['dateline'] < (TIMENOW - 2419200))) OR $forumid == 33">
output something
<else />
<if condition="$show['member']">
output something
</if>
</if>
|
|
#3
|
||||
|
||||
|
You are missing a closing parenthesis. Probably needs to before the OR.
-- hugh |
|
#4
|
|||
|
|||
|
Whoops, nice spot.
(Edited my post too) |
|
#5
|
||||
|
||||
|
I'm surprised the template compiler didn't barf when MrEyes saved that one. I would expect it to throw an error and do the "go back and fix the error, or continue regardless" thing.
-- hugh |
|
#6
|
|||
|
|||
|
It doesn't really check the contents of the condition except to check function calls, only that the <if> tags are opened/closed correctly.
|
|
#7
|
|||
|
|||
|
Thanks for that, it works perfectly
Well after a minor edit I had to change<else /> <if condition="$show['member']"> output something </if> </if> to <else /> <if condition="!$show['member']"> output something </if> </if> for that condition to be hit by logged out users |
|
#8
|
||||
|
||||
|
Although this is correct:
Code:
<if condition="!$show['member']"> Code:
<if condition="$show['guest']"> |
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|