|
16. 10. 2009. | #1 |
Goran Pilipović
Sir Write-a-Lot
|
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! |
|
|
Slične teme | ||||
Tema | Početna poruka teme | Forum | Odgovori | Poslednja poruka |
Smarty 3 Released | bluesman | PHP | 27 | 19. 03. 2011. 01:30 |
smarty - assign_by_ref | ivanhoe | PHP | 2 | 14. 10. 2009. 21:46 |
Smarty register_resource() - db: | bluesman | PHP | 9 | 10. 02. 2006. 09:40 |
Alternativa za Smarty | oliver78 | PHP | 10 | 21. 01. 2006. 17:07 |
Zašto Smarty? | Ilija Studen | PHP | 47 | 24. 12. 2005. 17:11 |