On 08-09-2008 at 12:27:50 Ernesto Baschny [cron IT] <[EMAIL PROTECTED]> wrote:

I could try some nested "?" expressions, but this turns out to be quite ugly, e.g. if I would have more than 2 classes to set

You can concatenate strings in php: expressions - just add spaces around ".", i.e.:

tal:attributes="class php:(a?'b':'c') . (d?' e':' f')"


or you can use the ${} syntax:

<li class="${php:...} ${php:...}">

alternatively, if you work with such classes a lot, you can make syntax nicer by writing your own expression modifier:

tal:attributes="class my_classes:repeat.item"

and create:

function ($argument,$nothrow)
return 'php_function_to_execute_when_template_runs('.phptal_tales($argument,$nothrow).')';


regards, Kornel

PHPTAL mailing list

Reply via email to