[Zope] ZPT - handling empty table cells with
Alec Mitchell
apm13 at columbia.edu
Mon Jan 3 12:11:07 EST 2005
On Monday 03 January 2005 08:43 am, David Pratt wrote:
> Probably a pretty simple question. The following gives me an
>   in my output which is probably what I am telling it to do.
> I want a simple so that my empty td's have contents when there
> is nothing in them and my tables will behave in IE.
>
> <td tal:define="option_description option/description">
> <span tal:condition="python:option_description == ''"
> tal:content="string: " tal:omit-tag="">
>
> </span>
> <span tal:condition="python:option_description != ''"
> tal:content="option_description" tal:omit-tag="">
> Description goes here.
> </span>
> </td>
>
> Can someone advise me what I should be substituting in the string to
> provide the desired output. Also, is there a better way of handling
> empty table cells than a separate set of condition statements for each
> td that may be empty?
You can just change 'string: ' to 'structure string: ', so that it
is not html quoted. I would also use 'tal:replace' in place of 'tal:content'
and 'tal:omit-tag', and perhaps simplify the conditions to
'tal:condition="option_description"' and 'tal:condition="not:
option_description"' (unless you explicitly want to show non-string false
values like 0, False, [], {}, (), None as strings, which you may).
Alec Mitchell
More information about the Zope
mailing list