Forums / Developer / Custom tag to display child nodes

Custom tag to display child nodes

Author Message

Bruce Morrison

Sunday 07 March 2004 7:31:29 pm

I've created a custom tag to display a nodes children in an XML field. I wondering if this is a good idea or the best way of doing this.

I realise that this could be accomplished using the object tag but that would require that each child is added individually. Also the list would not be updated if children were added or removed.

Interested in comments.

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Balazs Halasy

Monday 08 March 2004 12:40:42 am

Hmm,

What is it that you wish to accomplish/do? I usually just add an additional boolean attribute to the class which says "Show children" - then I make sure that the template code checks this and that it displays the children (in a desired fashion) if the attribute is true (the checkbox is checked). Not sure if this is helps or not...

Balazs

Bruce Morrison

Monday 08 March 2004 3:18:14 pm

Hi Balazs,

I'm tring to give the content editor more control over the content. If I have a content type that has a title and a xml text field, then this custom tag would allow them to place a list of the current nodes children within the text. Because it is in a XML text field it can be placed anywhere within the content and given context.

If you add a "show children" attribute that shows the child objects then they are displyed in a static fashion, controled by the template. This also needs to be added to each content type, where as having a custom tag works across all content types (that contain an XML text field).

I guess I'm looking at the cleanest way of doing this.

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish