On Wednesday, June 6, 2001, at 06:18 PM, Ian Bicking wrote: <snip> > Yeah, but it won't always work, even if you are clever. Like if you > want to highlight the background of rows that match some condition. > > <tr bgcolor="<dtml-if c>#ffdddd<dtml-else>#ffffff</dtml-if>"> > <snip> > Though I'm not entirely sure how you would do this in ZPT either -- > tal:condition and tal:attributes don't really nest, so how do you > conditionally change an attribute? Well, if you read my earlier message you know that I have TAL working within the context of webkit and am using it daily. The order of evaluation of TAL attributes according to http://www.zope.org//Wikis/DevSite/Projects/ZPT/TAL%20Specification%201.2 is: define condition repeat content or replace attributes So, In TAL, I would probably do this (file PrettyTable.html): ----- <html> <head> </head> <body> <table> <tr tal:repeat="row python:page.getRows()"> <td tal:define="color python:page.getColor(row)" tal:content="row" tal:attributes="bgcolor color"> Dummy Content </td> </tr> </table> </body> </html> ----- And on my page object I would define: ----- from TALPage import TALPage class PrettyTable(TALPage): base = '/path/to/html/files/' file = 'PrettyTable.html' def __init__(self): TALPage.__init__(self) self._rows = ['Foo', 'Bar', 'Baz', 'Fred', 'Flintstone'] def getRows(self): return self._rows def getColor(self, row): if (self._rows.index(row) % 2): return "#ffdddd" else: return "#ffffff" ----- Donovan _______________________________________________ Webware-devel mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/webware-devel
