On Sat, 27 Aug 2005 14:26:48 -0700 "richard head" <[EMAIL PROTECTED]> wrote:
> I am making a tree view, the layout for each node is in a template. I would
> like to use this template recursively to generate all of a given node's
> children and their children etc....
You can use a TT View to do this:
[% VIEW treeview %]
[%- BLOCK list -%]
<ul>
[% FOREACH e = item %]
<li>
[% IF num_lookup.${e.first}.empty %]
[% q(e.first) %]
[% ELSE %]
<a href="[% aself %][% p(e.first) %]/">[%
q(e.first) %]</a>
[% END %]
[%- IF e.last.first -%]
[%- view.print(e.last) -%]
[%- END -%]</li>
[%- END %]
</ul>
[% END -%]
[% END %]
[% treeview.print(self.st) %]
In this example code, you pass the view a list/array "self.st" of elements
which get then structured into a tree. The list itself consists of array
references (or hash references) with properties such as name, link and the
subtree. The subtree is then passed to the view again: "view.print(e.last)".
pgpsAf5biLKpF.pgp
Description: PGP signature
