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

Andy Wardley abw at wardley.org
Mon Apr 14 07:31:47 BST 2008


Daniela Wersin wrote:
> I want to prevent 
> components to appear in that list whose name begins with "Z -". How do I 
> do that?
> 
>  <td>
>       <select name="component" onchange="set_assign_to();" size="5">
>         [%- FOREACH c = product.components %]

[%              NEXT IF c.name.match('^Z') %]

(or put the inner block in an UNLESS c.name.match('^Z') ... END block)

HTH
A





More information about the templates mailing list