[Zope] ZPT - handling empty table cells with  

Paul Winkler pw_lists at slinkp.com
Mon Jan 3 12:26:04 EST 2005


On Mon, Jan 03, 2005 at 09:11:07AM -0800, Alec Mitchell wrote:
> 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: &nbsp;" tal:omit-tag="">
> >   &nbsp;
> >  </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: &nbsp;' to 'structure string: &nbsp;', so that it 
> is not html quoted.  I would also use 'tal:replace' in place of 'tal:content' 
> and 'tal:omit-tag' ...
(snip)

WHy not leave out tal:replace or tal:content entirely?

 <span tal:condition="python:option_description == ''"
       tal:omit-tag="">
   &nbsp;
 </span>

That has the effect I think you're after.

-PW

-- 

Paul Winkler
http://www.slinkp.com


More information about the Zope mailing list