[Templates] IN keyword?
Bill Moseley
moseley at hank.org
Mon Oct 8 15:46:54 BST 2007
On Mon, Oct 08, 2007 at 09:01:55AM +0100, Andy Wardley wrote:
> Paul Makepeace wrote:
> > [% IF val IN c.req.param(name); 'checked="checked"'; END %] />
>
> Add my vote for grep()
>
> [% 'checked="checked"' IF c.req.param(name).grep(val) %]
>
> It works equally well if c.req.param returns a scalar or list ref.
Won't that always return true? I thought grep returned an array
reference. Maybe:
IF c.req.param(name).grep(val).size
Plus, have to be careful that val isn't a substring. \b$val\b
perhaps.
--
Bill Moseley
moseley at hank.org
More information about the templates
mailing list