[PHPTAL] AGAIN : tal:attributes - semicolon bug? -> I think so

Kornel Lesinski kornel at aardvarkmedia.co.uk
Mon Apr 14 15:04:28 CEST 2008


On Mon, 14 Apr 2008 11:02:09 +0100, Nestor A. Diaz  
<nestor at tiendalinux.com> wrote:

> Hello, i have the same bug/problem when dealing with semicolons in  
> tal:attributes.
>
> Does anybody can provide some hints on how to fix it ?

>> <td
>>     tal:repeat="data person"
>>     tal:content="data"
>>     tal:attributes="style php: repeat.person.odd ? 'background: #eee;'  
>> : false"
>> />

tal:attributes expects multiple attributes separated by semicolon, so  
semicolon in #eee; accidentally ends the style attribute.

To prevent that you should use double semicolon:

tal:attributes="style php: repeat.person.odd ? 'background: #eee;;' :  
false"

but it seems that PHPTAL fails to change double semicolon to single one.  
I'll try to fix this, but I think the proper solution is to use class name  
instead of hard-coded style:

<td tal:attributes="class php:repeat.person.odd ? 'odd' : NULL">

-- 
regards, Kornel



More information about the PHPTAL mailing list