After looking at the wiki page examples, couldn't we solve this with specialized tales modifiers?

<option tal:repeat="opt options" tal:attributes="selected equals: opt, selected_option"/>


<tr tal:repeat="row rows" tal:attributes="class ternary:repeat.row.odd, 'odd', 'even'"/>

It's a bit more verbose but they are quite declarative and should be easy to implement in the current PHPTAL infrastructure.

/imv

On 11/17/09 2:05 PM, Kornel Lesiński wrote:
On 17-11-2009 at 12:35:02 Marco Pivetta <ocram...@gmail.com> wrote:

I know it's not an elegant solution, but it's a solution and I already use it: what about tal:define? It is already possible to fix those tales problems wrapping content within a tal:omit-tag-ed "definer element" or directly a tal:define block.

I don't understand how does it help.

If you have "selected_id" variable and want to select <option> with that ID, how would you do it with tal:define? without help of php: modifier?

even/odd classes can be done with pure TALES and tal:omit-tag, but it's ugly:

<tr class="even" tal:omit-tag="repeat/row/odd">
<tr class="odd" tal:omit-tag="repeat/row/even">
</tr>
</tr>

I'm probably loosing the point of the discussion, but I don't really see any reason to make the syntax more complex and also a bit heavyer to compute for the parser...

This would be heavier only once during template compilation, so performance is not a problem.

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

Reply via email to