This shows you the differences between two versions of the page.
improvedtales [2009/11/17 11:51] Kornel created |
improvedtales [2024/05/31 06:15] (current) 104.194.134.81 1 |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Advanced TALES syntax ====== | ====== Advanced TALES syntax ====== | ||
- | TALES can't handle few cases that happen often and seem quire reasonable to do in templates. | + | TALES can't handle few cases that happen often and seem quite reasonable to do in templates. |
It can't compare values: | It can't compare values: | ||
<option tal:repeat="opt options" tal:attributes="selected php:opt == selected_option"/> | <option tal:repeat="opt options" tal:attributes="selected php:opt == selected_option"/> | ||
+ | |||
+ | <title tal:condition="php:count(allimages)==1">Photo</title> | ||
+ | <title tal:condition="php:count(allimages) GT 1">${php:count(allimages)} photos</title> | ||
+ | |||
+ | It doesn't have logic expressions: | ||
+ | |||
+ | <div tal:condition="php:canShowFoo AND foo.isAvailable()"> | ||
It can't compute values conditionally: | It can't compute values conditionally: | ||
Line 14: | Line 21: | ||
<h1 tal:content="php:substr(header, 0,100)"/> | <h1 tal:content="php:substr(header, 0,100)"/> | ||
+ | |||
+ | <div tal:content="structure php:getAdvert(PAGE_TOP)"> | ||
+ | |||
Line 19: | Line 29: | ||
FIXME | FIXME | ||
+ | |||
+ | 1 |