Got it!! passing several $vars to template

Martin d'Anjou Martin.Danjou at neterion.com
Tue May 31 20:45:57 UTC 2005


> Thanks, it worked. Can you please help me some more? Once I get inside the 
> template, is it possible to create a loop that goes through all the Bug 
> objects and print a list of messages:
> 
> Bug N has been added to the database ...
> Bug N+1 has been added to the database ...
> Bug N+2 has been added to the database ...
> ...
> 
> I tried the following but it does not work, so I'm digging more into it.  
> Is this the right approach for this problem?
> 
> [% FOREACH bugitem = bug %]
>   [% FOREACH item = bugitem.sentmail %]
>     [% PROCESS bug/process/results.html.tmpl
>        type = item.type
>        id = item.id
>        mail = item.mail
>      %]
>   [% END %]
> [% END %]
> 
> Thanks,
> Martin
> PS: my last sent bounced, this is a resend.

Actually, it is much easier than that... I just noticed that
$vars->{'sendmail'} has one item per bug, so I do not need the outer loop.
To create multiple bugs at once, e.g. create the loop inside the
post_bug.cgi, all I need is to move "$vars->{'sendmail'} = [];" to the
begining of the loop. When I am done the loop, pass $vars along to the
created.html.tmpl template, et voila!

Martin




More information about the developers mailing list