Log in

View Full Version : create custom conditionals


harmor19
10-22-2005, 12:46 PM
does anyone know how to make custom conditionals for templates?

Marco van Herwaarden
10-22-2005, 02:03 PM
Please explain more what you want.

harmor19
10-22-2005, 02:32 PM
I just want to know the procedure on how to make one for future reference.
Right now I don't really need it.

Alan @ CIT
10-22-2005, 03:33 PM
I'm not entirely sure what your asking - what do you mean by "custom conditionals" ?

A template conditional is just:

<if condition="$something"> ...html... </if>

Which in english, translates to "If $something is equal to true, then echo this html".

In your PHP script / plugin / etc, you'd set:

$something = true; if you wanted the template conditional to run.

(hopefully that makes sense) :)

harmor19
10-22-2005, 03:48 PM
so I used this is the php script

if($this == $that)
{
$something = true;
}

Then in the template I'd use

<if condition="$something"> ...html... </if>


Is that how it's done?

Alan @ CIT
10-22-2005, 03:52 PM
Yep, that's exactly it.

harmor19
10-22-2005, 04:27 PM
I thought I had to do with "iif"

Thanks for the help.

Marco van Herwaarden
10-22-2005, 07:25 PM
'iif' was an extension to PHP that was used in vB3.0. It is now depreciated in favour of the regular php syntax.