Make a table of content from a XML Block

Author Message

Damien Pobel

Tuesday 10 January 2006 7:22:04 am

hello,

I'm working on a site where pages are build with an XML Block. I'm looking for a way to build a table of content of the page from the XML Block content.

For example :
My XML Block :

<header level='1' anchor_name='t1'>title 1</header>
Lorem ipsum dollor...
<header level='1' anchor_name='t2'>title 2</header>
Lorem ipsum dollor...

and I'd like to automaticaly generate :

<ul>
  <li><a href="#t1">Title 1</a></li>
  <li><a href="#t2">Title 2</a></li>
</ul>

I have already thought to write an operator (http://ez.no/products/ez_publish_cms/documentation/development/extensions/template_operator ) that returns an array from the XML Block containing the anchors but I wonder if there is a better (easier) solution ?

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish

Benedikt Grande

Tuesday 10 January 2006 3:05:39 pm

Hi Damien,
I am working with ymc (young media concepts - www.ymc.ch) and we recently developed a new operator, called wikioperator. This operator does what you need. It replaces the header-tags with some more content and generates a link list out of the headers. It can be used to create a wiki article out of some xml text.
If you are still interested this operator could be what you were searching for.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.