bcochofel has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I'm having trouble with HTML::Template cascading TMPL_LOOP. I have an MySQL table and I'm fetching results to fill one LOOP, this works great. The problem is with a template that has cascading TMPL_LOOP, something like:
<!-- TMPL_LOOP SITES --> <p><!-- TMPL_VAR NAME="URL" --></p> <!-- TMPL_LOOP TAGS --> <p><!-- TMPL_VAR NAME="TAG_NAME" --></p> <p><!-- TMPL_VAR NAME="TAG_WEIGHT" --></p> <!-- /TMPL_LOOP --> <!-- /TMPL_LOOP -->
My table as the following fields: id, url, tag, weight and usrid. I can have several equal url with diferent tag,weight values, and I want to fill that in the HTML::Template His there any simple way to achieve this? Thanks, Bruno

Replies are listed 'Best First'.
Re: cascade TMPL_LOOP with DBI values
by tinita (Parson) on Dec 09, 2006 at 21:01 UTC
    sure, where's the problem?
    just fill the following data structure to HTML::Template:
    SITES => [ { URL => '...', TAGS => [ { TAG_NAME => 'foo', TAG_WEIGHT => 23 }, { TAG_NAME => 'bar', TAG_WEIGHT => 42 }, ], }, { # second url... }, ]
Re: cascade TMPL_LOOP with DBI values
by marto (Cardinal) on Dec 09, 2006 at 21:59 UTC
Re: cascade TMPL_LOOP with DBI values
by wfsp (Abbot) on Dec 10, 2006 at 07:36 UTC
      Thanks, I'll give it a try...