[html-template-devel] Recursive templates?

Edi Weitz edi at agharta.de
Tue Jul 18 14:17:23 UTC 2006


Hi!

On Mon, 17 Jul 2006 15:15:07 -0500, Eli Naeher <enaeher at onshored.com> wrote:

> I've begun using (and enjoying) the html-template package but have
> run up against the fact that I can't create recursive templates,
> apparently because TMPL_INCLUDE is evaluated before any conditionals
> are. Are there any patches around to implement this, or is there a
> workaround? I'm trying to build a tree out of nested lists, and I'd
> like to be able to make a template 'list-item,' looking something
> like:
>
> <!-- TMPL_LOOP list-items -->
>    <li><!-- TMPL_LOOP item-name -->
>    <!-- TMPL_IF sub-list -->
>       <ul>
>       <!-- TMPL_LOOP sub-list -->
>          <!-- TMPL_INCLUDE 'list-item' -->
>       <!-- /TMPL_LOOP -->
>       </ul>
>    <!-- /TMPL_IF -->
> <!-- /TMPL_LOOP -->

There's currently no way to do what you want because the library
explicitely checks for recursive INCLUDE tags.  Changing that would be
non-trivial and I don't have the time to do it.

I'd be happy to review patches, though, provided they are clean, well
tested, documented, and follow the coding standards in the rest of the
code.

Cheers,
Edi.



More information about the Html-template-devel mailing list