The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Coding question
Hi,
pardon this question (actually two); I'm a complete newbie when it comes to coding. I would like to modify the following in a vB 3.5.4 template: <if condition="$show['foo']"> and I would like to modify the above like so: <if condition="$show['foo']" EXCEPT WHEN [if condition ="$A[X]" AND if condition"$[Y]"]> or in other words do the operation as normal except when two other conditions are simultaneously met. How best do I code that? Sorry if I sound painfully dumb; I am indeed a newbie. ______ That's the one question; my next question also refers to the above. In the above, [Y] has a range of values, so I am looking at some kind of array, I suppose like so: <if condition="$show['foo']" EXCEPT WHEN [if condition ="$A[X]" AND if condition"$[ARRAY(Y)]"]> How best do I code that? ______ Many thanks in advance, and please pardon my ignorance. It occurs to me it would be easier to do a nested "if" set, like so: Code:
<if condition ="$A[X]" AND if condition"$[ARRAY(Y)]" AND if condition="$show"] show 'alternate'> else <if condition="$show['foo']" show 'foo'> </if> </if> Many thanks in advance for help and patience. |
#2
|
||||
|
||||
Code:
<if condition="$show['foo'] and !$otherVarA and !$otherVarB"> |
#3
|
||||
|
||||
Don't use single quotes inside of template conditional varibles.
use $show[foo] instead of $show['foo'] |
#4
|
||||
|
||||
Quote:
If foo is a constant, you will run into some problems that will probably take hours to solve. Remember that conditions are parsed like so (NOT in double quotes!): Code:
blah blah <if condition="$condition">Do this<else />Or Do This</if>blah blah Code:
blah blah " . ($condition ? "Do This" : "Or Do This") . "blah blah PHP Code:
|
#5
|
||||
|
||||
Quote:
|
#6
|
||||
|
||||
Quote:
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|