[Zope] ignore empty fields with tal

Andrew Veitch andrew at logicalprogression.net
Mon Sep 8 16:21:50 EDT 2003


>> i'm currently using below
>> 
>> etc
>> <tr tal:repeat="opening here/subject_sources">
>> <td>
>> Title and URL <a href="link" tal:attributes="href opening/url"><span
>> tal:replace="opening/title">title</span></a>
>> </td>
>> </tr>
>> etc
>> 
>> some of the titles have url's some haven't.
>> 
>> using above - all titles are links, is there a way to ensure that the
>> titles are not displayed as links if the record is empty?

<tr tal:repeat="opening here/subject_sources">
  <td>
    Title and URL
    <a href="link"
       tal:attributes="href opening/url"
       tal:omit-tag="not:opening/url"
       tal:content="opening/title">Title</a>
  </td>
</tr>

Is how I'd do it. Rather than 'not' you might need to use 'exists' depending
on how the results are returns.

Andrew

-- 
Logical Progression Ltd, 20 Forth Street, Edinburgh EH1 3LH, UK
Tel: +44 (0)131 550 3733 Web: http://www.logicalprogression.net/




More information about the Zope mailing list