I think Brett already answered this.
 
if (defined $x->{y}):
    [% IF x.y.defined %]
 
    http://tinyurl.com/dapjp (template-toolkit.org)
 
 
if (exists $x->{y}):
    [% IF x.exists(y) %]
 
    http://tinyurl.com/athme (template-toolkit.org)

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jonathan Mangin
Sent: Wednesday, July 20, 2005 11:39 AM
To: John Smith; [email protected]
Subject: Re: [Templates] checking for defined and exists in a template

Hmmm (reading the manual), maybe this would work.
 
[% IF x.$y %]
 
[% IF x.$y == 'foo' %]
 
 
----- Original Message -----
From: John Smith
Sent: Wednesday, July 20, 2005 7:33 AM
Subject: Re: [Templates] checking for defined and exists in a template

Maybe I should restate. What is the perl template toolkit directive equivalent of:
 
if (defined $x->{y})
 
-- or --
 
if (exists $x->{y})
 
Thanks.

Jonathan Mangin <[EMAIL PROTECTED]> wrote:
[% IF x %]
 
or
 
[% IF x == 'foo' %]
 
Combining constructs would be redundant.
 
 
 
----- Original Message -----
From: John Smith
Sent: Tuesday, July 19, 2005 4:02 PM
Subject: [Templates] checking for defined and exists in a template

Suppose I want to do an include only if something is defined,
how do I do it?
 
[% IF x.defined and x eq "foo" %]
    [% INCLUDE myfile %]
[% END %]
 
something like that? can't seem to locate it in the
man pages.
 
Thanks.


Start your day with Yahoo! - make it your home page


Start your day with Yahoo! - make it your home page

Reply via email to