The ternary operator is implemented in smarty 3. It can be used on assignments and output.
Examples:
{$x=($y==2)?$foo:$bar}
{assign var=x value=($y==2)?$foo:$bar}
{($y==2)?$foo:$bar}
If you modifiers you have to put the expression into parentheses to avoid ambiguity of the ':'.
{($y==2)?($foo|truncate):$bar}
Mislim da polako developeri zadiru sve više u Smarty i zahtevaju klasične programerske "shortcuts", nekako nisam baš za ovo (iako je meni lakše).
__________________
Goran Pilipović a.k.a. Ugly Fingers Bradley f.k.a. bluesman
I don't always know what I'm talking about but I know I'm right!
|