Re: undefined vars in 'if' statements

From: Date: Tue, 22 Feb 2000 19:31:19 +0000
Subject: Re: undefined vars in 'if' statements
References: 1 2 3 4 5  Groups: php.template 
Request: Send a blank email to php-template+get-202@lists.php.net to get a copy of this message
On Tue, 22 Feb 2000, Dan Libby wrote: > For example: > > {{:if $fname=="dan"}} > First: {{fname}}<BR> > Last: {{lname}} > {{/:if}} > > In this case, if lname is undefined, it would be blank, however in the next > example the entire if statement would be hidden. What would you do if it also has {{ else }}? > {{:if $fname=="dan" autohide="yes"}} > First: {{fname}}<BR> > Last: {{lname}} > {{/:if}} > > The alternative is: > > {{:section foobar autohide="yes"}} > {{:if $fname=="dan"}} > First: {{fname}}<BR> > Last: {{lname}} > {{/:if}} > {{/:section foobar}} Maybe what we need are anonymous sections, i.e. those without a name. These can be used to just show/hide blocks of content. > Seems reasonable. We need to define the difference between undefined and an empty > string though. Any ideas? -Andrei "In My Egotistical Opinion, most people's C programs should be indented six feet downward and covered with dirt." -- Blair P. Houghton

« previous php.template (#202) next »