RE: [Zope] Newbie: TAL Conditions
You could wrap each <td></td> in a <span tal:omit-tag="" tal:condition=""></span> The tal:omit-tag="" will prevent the <span></span> to be output in the resulting HTML code. Pascal -----Message d'origine----- De : zope-bounces@zope.org [mailto:zope-bounces@zope.org]De la part de Tom_Rectenwald@carmax.com Envoyé : mardi 7 décembre 2004 15:21 À : zope@zope.org Objet : [Zope] Newbie: TAL Conditions Hello all, I am a newbie at Zope, slowly traversing the learning curve. I am focusing on TAL currently, and am quite a bit confused with the tal:condition syntax. I have a Z SQL Method that selects all records from a table in a PostgreSQL database. This method is called "getTransfers". I then have a Page Template called "displayTransfers" that displays the results as tabular HTML. This works fine. However, where there isn't a record (i.e. an empty string), a <TD> will not be defined so that it leaves ugly gaps in the table. To ensure that a '<TD> </TD>' replaces an empty string '' I added two tal:condition statements. This works, but is sort of ugly looking as, in my head, it is the equivalent of two 'if' statements when it should be an 'if/else'. The below code works, however is there a cleaner way to do this? ### START CODE ### <table border="1"> <tr><th>Date</th><th>Server</th></tr> <tr tal:repeat="transfer container/getTransfers"> <td tal:content="structure transfer/time_stamp">time_stamp</td> <td tal:condition="python: transfer.server==''"> </td> <td tal:condition="python: transfer.server!=''" tal:content="structure transfer/server">server</td> </tr> </table> ### END CODE ### I'm from a PHP/Perl/mySQL/postgreSQL background and am new to OOP, Python and Zope so I greatly appreciate any assistance with this. Regards, Tom ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **********************************************************************
participants (1)
-
Pascal Peregrina