[Petal] Tree Tactics

Fergal Daly fergal at esatclear.ie
Thu Sep 1 22:31:14 BST 2005


You can create a custom modifier that takes a template name and a set of 
named arguments, it loads and executes the template, passing in the 
arguments. That's how I've done it in the past.

It's in the mailing list archives I think,

F

On 9/1/05, Josh Narins <josh at narins.net> wrote:
> 
> > I've got a tree, with arbitrary depth, like..
> >
> > {
> > text => 'This is the top',
> > sort => [5,3,7],
> > children =>
> > 3 => {
> > text => 'This should be second',
> > sort => [4,6],
> > children {
> > 4 => { text=>'a leaf',},
> > 4 => { text=>'another leaf',},
> > },
> > 5 => ...
> > 7 => ...
> > }
> > }
> >
> > I hope you get the idea.
> >
> > How do I get this to work in Petal?
> >
> > I figure I should be able to do it with a single template.
> >
> > myself.xml
> > ==========
> >
> > <table>
> > <tr>
> > <td petal:content="object/text">
> > This is dummy text
> > </td>
> > <td petal:repeat="SOMETHING HERE">
> > <xi:include href="./myself.xml" />
> > </td>
> > </tr>
> > </table>
> >
> > What should that repeat be? I can do it with "each:" but then I don't
> > get any order. I want the order to be that as described in the sort
> > array ref.
> >
> > How does anyone handle recursive trees?
> 
> No one has recursive tips?
> 
> 
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.webarch.co.uk/pipermail/petal/attachments/20050901/8070ffee/attachment.html


More information about the Petal mailing list