RE: [Zope] Design/DTML question
From: Timothy Wilson [mailto:wilson@visi.com]
Right now, I've got the dates stored in a TinyTable. I can iterate through that list and generate the links, but I can't figure out how to display the table in two columns.
<table width=100% border=0 cellpadding=4> <tr align=left valign=top> <dtml-in meetingDateTable> <dtml-if sequence-even><tr align=left valign=top></dtml-if> <td width=50%> <dtml-var meeting_date> </td> <dtml-if sequence-end><dtml-if sequence-even> <td width=50%> <!-- an empty cell --></td> </tr> </dtml-if></dtml-if> <dtml-if sequence-odd></tr></dtml-if> </dtml-in> </table> regards Max M
At 1/10/01 04:44 PM, Max Møller Rasmussen wrote:
From: Timothy Wilson [mailto:wilson@visi.com]
Right now, I've got the dates stored in a TinyTable. I can iterate through that list and generate the links, but I can't figure out how to display the table in two columns.
<alternating column solution by Max M deleted for brevity>
Or, if you insist that dates flow down the columns like I do, you could use this untested revision of Max's solution: <table width=100% border=0 cellpadding=4> <tr align=left valign=top> <td width=50%> <dtml-in meetingDateTable> <dtml-if "_.int(_['sequence-index'])*2==_.int(_['count-id']) or _.int(_['sequence-index'])*2==_.int(_['count-id'])+1"> </td><td width=50%> <!-- moved to next column --> </dtml-if> <dtml-var meeting_date><br> </dtml-in> </td> </tr> </table> Gosh, wouldn't it be nice to have a sequence-midpoint ? But then somebody would surely want a sequence-first-quartile and so on :-) -- Dennis Nichols nichols@tradingconnections.com
On Wed, 10 Jan 2001, Dennis Nichols wrote:
Or, if you insist that dates flow down the columns like I do, you could use this untested revision of Max's solution:
<table width=100% border=0 cellpadding=4> <tr align=left valign=top> <td width=50%> <dtml-in meetingDateTable> <dtml-if "_.int(_['sequence-index'])*2==_.int(_['count-id']) or _.int(_['sequence-index'])*2==_.int(_['count-id'])+1"> </td><td width=50%> <!-- moved to next column --> </dtml-if> <dtml-var meeting_date><br> </dtml-in> </td> </tr> </table>
This doesn't seem to work. The if statement only evaluates to true the first time through the loop. I agree that the dates must flow down, so don't I need to have some way to do the following: <table> <dtml-in meetingDateTable> <tr> <td><dtml-var meeting_date></td> <td><dtml-var meeting_date[some later index]></td> </tr> </dtml-in> </table> It's the [some later index] part that would seem to be the bugger. Doable? Perhaps this would be a perfect application for a PythonScript? -Tim -- Tim Wilson | Visit Sibley online: | Check out: Henry Sibley HS | http://www.isd197.k12.mn.us/ | http://www.zope.org/ W. St. Paul, MN | | http://slashdot.org/ wilson@visi.com | <dtml-var pithy_quote> | http://linux.com/
From: Timothy Wilson
Or, if you insist that dates flow down the columns like I do, you could use this untested revision of Max's solution:
Oh typical spine reaction I didn't read the dates, just assumed that it was left/right as usual. This untested code might work then: (The no-break tag <nobr> is really underestimated. It can save loads of table tags.) <table> <tr> <td><nobr> <dtml-if "_['sequence-index'] <= (_['batch-size']/2)"> <dtml-var meeting_date> </dtml-if> <td> <tr> <tr> <td><nobr> <dtml-if "_['sequence-index'] > (_['batch-size']/2)"> <dtml-var meeting_date> </dtml-if> <td> </tr> </table> Max M. W. Rasmussen, Denmark. New Media Director private: maxmcorp@worldonline.dk work: maxm@normik.dk ----------------------------------------------------- Specialization is for insects. - Robert A. Heinlein
At 1/10/01 01:22 PM, Timothy Wilson wrote:
On Wed, 10 Jan 2001, Dennis Nichols wrote:
Or, if you insist that dates flow down the columns like I do, you could use this untested revision of Max's solution <stuff removed>
This doesn't seem to work. The if statement only evaluates to true the first time through the loop.
Because the objects in the loop had no 'id' attribute? In any case, here's a complete tested example: <dtml-var standard_html_header> <dtml-call "REQUEST.set('meetingDateTable',['first','second','third','fourth','fifth'])"> <table border=1 cellpadding=4> <tr align=left valign=top> <td width=50%> <dtml-in meetingDateTable> <dtml-if "_.int(_['sequence-index'])*2==_.len(meetingDateTable) or _.int(_['sequence-index'])*2==_.len(meetingDateTable)+1"> </td><td width=50%> <!-- moved to next column --> </dtml-if> <dtml-var sequence-item><br> </dtml-in> </td> </tr> </table> <dtml-var standard_html_footer> -- Dennis Nichols nichols@tradingconnections.com
participants (4)
-
Dennis Nichols -
Max M -
Max Møller Rasmussen -
Timothy Wilson