Re: Tree Tactics
Fergal Daly <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.petal |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]> 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? > > >