On 27.06.2009, at 04:04, Daniel Lima wrote:

So, i am trying to do the same thing using PHPTAL but it dont works fine with increment counters.
My initial code is::

<table>
<tr>
<tal:block repeat="item test" define="i php:0;">
<td tal:content="php: i++">xxx</td>
<tal:block condition="php:(i==numberOfCols)" define="i php:1;">
</tr><td>
</tal:block>
</tal:block>
</table>

Further on PHPTAL dont accept the TR tag as closure.
Somebody can help me?

This approach is not going to work in PHPTAL.

TAL isn't a typical imperative programming language, it's more like functional language, where you're not supposed to use for loops and redefine variables.

TAL templates are XML. Opening and closing tags are not sparate things. XML is defined in terms of complete elements which always have to be closed properly.

<tr tal:define="rows php:array_chunk(items, numberOfColumns)"
    tal:repeat="row rows">
    <td tal:repeat="column row"
        tal:content="column"/>
</tr>

--
regards, Kornel




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

Reply via email to