[Templates] filter out items in a FOREACH loop (bugzilla template)

2008-04-13 Thread Daniela Wersin
Hi all, I'm struggling with filtering out certain items in a FOREACH loop. Can somebody please give me a tip? The following code is from a bugzilla template that builds an HTML pulldown list for all components of a product. I want to prevent components to appear in that list whose name begins wit

Re: [Templates] filter out items in a FOREACH loop (bugzilla template)

2008-04-13 Thread Andy Wardley
Daniela Wersin wrote: > I want to prevent > components to appear in that list whose name begins with "Z -". How do I > do that? > > > > [%- FOREACH c = product.components %] [% NEXT IF c.name.match('^Z') %] (or put the inner block in an UNLESS c.name.match('^Z') .

Re: [Templates] filter out items in a FOREACH loop (bugzilla template)

2008-04-14 Thread Kelly Thompson
I have used the same scenario. I have found that "sometimes" you CAN access a perl variable, via the template by appending the dollar sign and sending it in the vars hash. It will be available to the Template::Provider and Template::Grammer mods. (I think, help me out Andy) Like so: in perl script