On Tue, Jan 15, 2002 at 01:57:02PM +0100, Stefan Svensson wrote:
 
> I'm afraid this will not help. Let me explain what I want to do, and
> perhaps there are some other way to solve this that I have not yet
> thought of.

> I work on a WWW front-end to usenet news, and I would like to create a
> threaded view of all articles in a newsgroup. A very simple way to
> represent a threaded view is to use unordered lists:
> 
> <ul>
>   <li>Article one</li>
>   <ul>
>      <li>Re: Article one</li>
>      <ul>
>         <li>Re: Article one</li>
>         <li>Re: Article one</li>
>      </ul>
>      <li>Re: Article one</li>
>   </ul>
> </ul>


> In Perl, I create a recursive list of hashes, so that
> $list[$offset]{thread} points to another list of hashes. My idea was
> that the following template would work:
 
> But it does not work, since HTML::Template recursively includes
> thread.html an infinite number of times (or max_includes times) when the
> template is created, not when the template is evaluated.
> 
> Are there any other solutions to create a recursive template like this
> one?

Solution 1: Since you have the recursive structure, you could build the html
in code and output it.

Solution 2: Solution 1 suffers from the separation of code and html, so you
could use a filter which merely adds a '<tmpl_include ...>', but you'd have
to know when to stop, which means you need to evaluate value of the 'thread'
template, but you don't have direct access to it in your filter, so you
could do something like '<!-- thread (<tmpl_var name="thread">) >' and parse
for that in your filter (with a regex)

Solution 3: Since Solution 2 requires some expression handling, you could
use HTML::Template::Expr to do the hard work so you filter remains
simple-minded.

Solution 4: Since you are using HTML::Template::Expr anyway, you might want
to try your original solution using that to see if it works the way you
expect. If not, well, you have other solutions.

-Gyepi

-- 
Gyepi Sam 
Senior Developer
Palm Digital Media Group

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to