On 08-01-2009 at 21:47:29 Trent Moyer <tmo...@symons.com> wrote:

<tr tal:repeat="item list" tal:attributes="class alt:repeat/item/odd | nothing">
  ... HTML Code ...

The intent is to make every other row have a class="alt".

This is my code for the modifier:

function phptal_tales_alt( $src, $nothrow )
    $src = trim($src);
    return '( '.phptal_tales($src, $nothrow)." ? 'alt' : null )";

The problem that I am having is that this modifier and the example modifier given in the PHPTAL documentation do not work when used with multiple options (a | b | c). The code returned by phptal_tales_alt() is "( Array ? 'alt' : null )".

This is because your modifier gets all code, including "| nothing" part, and 
this causes phptal_tales() to return array with each part of the expression.

I've created phptal_tale() function (without 's') that always returns single 
expression, but code it returns is not very elegant (due to limitations of what 
constructs can be used in PHP expression).

To get it working you can also simply leave out the "| nothing" part.

regards, Kornel

PHPTAL mailing list

Reply via email to