[Zope] Generate Table of Contents

Sin Hang Kin iekentsin@infoez.com.mo
Tue, 25 Apr 2000 11:47:37 +0800


I want to generate the content of the page which in before all other
contents. How can I skip empty sections?

The details is an newsletter, the site is struct


root
   from_editor
   news
   information
   activities
   letters

The newsletter have a layout as

<dtml-var front_matters>
<dtml-var contents>
<dtml-var list_from_editor>
<dtml-var list_letters>
<dtml-var list_news>
<dtml-var list_information>
<dtml-var list_activities>


which each list_xx is:

<dtml-with xx>
<dtml-var listitems>
</dtml-with>

listitems will skip expired items automatically:

<dtml-in "objectValues(['DTML Document'])" sort="id" skip_unauthorized>
<dtml-if "(expiredate - ZopeTime() ) >= 0.0 ">
<dtml-var title_or_id>
<dtml-if "AUTHENTICATED_USER.has_permission( 'Change DTML Documents',
_['sequence-item'])">
<a href="manage_edit">Edit</a>
</dtml-if>
<dtml-if "(ZopeTime() - _['bobobase_modification_time']) > Newdate">
<em>New</em>
</dtml-if>
<ul compact><dtml-var sequence-item></ul>
</dtml-if>
</dtml-in>

The problem is I want to include a table of content automatically:

<dtml-if list_from_editor>
<p><a href="#fromeditor">From the Editors</a></p>
</dtml-if>

which will skip empty sections. However, that list_from_editor will rendered
to two blank link when no items in it.

Are there any good ways to perform this?

Rgs,

Kent Sin