passing several $vars to template

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


> > $template->process("bug/create/created_tree.html.tmpl", $vars)
> > 
> > Can someone show me how to pass multiple bugs through $vars to the 
> > template?
> 
> Just have $vars hold a member which is an array of Bug objects, instead
> of data on a single bug. I believe summarize_time.cgi does that.

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.




More information about the developers mailing list