Recursive result traversal in template

Author Message

James Kessel

Sunday 10 December 2006 11:22:07 pm

Hi,

The other day I was in need of a way to traverse a resultset and present the entire result as a tree structure. Getting the data from ezPublish with fetch was a breeze, but finding a way to recursively build the tree structure was not. After som dwelling I settled with the halfbreed sollution of using a custom template operator and returning the finished result ( html and data ). This, however, seems to me as quite an inadequate sollution since I loose the ability to further manipulate the data (using other ez template operators as ezurl, wash...etc). I Guess what I was looking for was a way to define custom functions for use in ezPublish. So, the question is, Is there an easy way to define custom template functions with ez; or, is there another way to accomplish what I did with more flexibility ?

Regards,

Claudia Kosny

Wednesday 13 December 2006 2:05:15 pm

Hi James

I am not sure where the difference between a custom template operator and a custom template function is, for me they are just two names for essentially the same thing.

Without getting an example of what you were trying to achieve, it is hard to say whether there is a better solution, but generally I wouldn't return html from a custom template operator. After all I can add the html in the template.

So post an example and I'll have a look at it.

Claudia

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