You're the man Kornel, thanks.

Kornel Lesiński pisze:
On 05-03-2009 at 10:15:52 Mr Brightside <scors...@epf.pl> wrote:

Hello,
I'm trying to apply some css classes to alternate rows in my table.
According to the PHPTAL manual, you can use this:

tal:attributes="class php: repeat.ranking.odd ? 'odd' : NULL"

It works fine, but there's a better way suggested using a custom modifier:

tal:attributes="class css-odd:repeat/ranking/odd"

Now, I have no idea how to go about writing this custom modifier.
First, I don't think the name `css-odd` will work since you can't name a php function like so:

function phptal_tales_css-odd($src, $nothrow) {}

You can name it phptal_tales_css_odd(…)

But this is not the problem (you can change the modifier name...).
In fact, I'm not quite sure what the body of this function should be like.

phptal_tale($src, $nothrow) will return a string that contains PHP expression that evaluates whatever was passed to the modifer.


e.g.
return '(' . phptal_tale($src, $nothrow) . ' ? "even" : "odd" )';


You can create your own custom syntax for your modifier by parsing $src, e.g.:
list($expression,$even_class,$odd_class) = explode(' ',$src);
…


------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG - www.avg.com Version: 8.0.237 / Virus Database: 270.11.8/1985 - Release Date: 03/05/09 07:54:00


---------------------
Panorama Internetu - prognoza pogody, poczta e-mail, SMS, wyszukiwarki: Gooru, 
Anonser, serwisy: randki, ogl�oszenia, wakacje, program TV, Kina,  muzyka, DVD, 
newsy, inne.
http://www.panoramainternetu.pl/ (http://www.epf.pl/)

_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to