[ZPT] Conditional closing </tr> tag for TAL

Takahashi, Michael MTakahashi at oid.ucla.edu
Mon Jun 20 11:59:50 EDT 2005


Hi Guys,

 

I'm developing a dynamic ZPT that builds a table dynamically from an
external database. I'd like to create a table row with at most two
columns.  The condition is that if there is an odd number of data, the
last table row will only contain one <td>.  If there is an even number
of data, then the last table row will contain two <td>'s.  Sounds pretty
simple right?  Just create a condition on the closing </tr> tag....well
as I have found out, it's not so simple in TAL.

 

For example:

 

4 items of data will create two table rows

 

<tr>

   <td></td>

   <td></td>

</tr>

<tr>

   <td></td>

   <td></td>

</tr>

 

5 items of data will create 3 table rows

 

<tr>

   <td></td>

   <td></td>

</tr>

<tr>

   <td></td>

   <td></td>

</tr>

<tr>

   <td></td>

</tr>

 

 

In TAL, you cannot create a condition on a closing tag because Zope will
treat it as invalid HTML since the opening <tr> tag will not have a
closing </tr> tag.  This really makes simple tasks such as mine very
complex now.

 

Ideally, I would like TAL to function somewhat like so without Zope
complaining:

 

<tal:tr condition="logic goes here"></tr></tal:tr> 

 

 

Any suggestions?

 

Thanks,

 

Mike

 

 

 

Mike Takahashi
Web Developer * TEC at OID

UCLA Office of Instructional Development
mtakahashi (at) oid.ucla.edu
310.794.9371

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zpt/attachments/20050620/f99b3480/attachment.htm


More information about the ZPT mailing list