[MTOS-dev] testing var for empty before using in mt:loop

Steve Ivy steveivy at gmail.com
Thu May 1 15:39:50 PDT 2008


In this case, the code does a lookup of "all URIs for this Friend" and
assigns it to a param. It may be empty. In the tmpl, I want to show a
"No URIs" message instead of dropping into the loop if uris has no
entries.

On Thu, May 1, 2008 at 3:34 PM, Timothy Appnel <tim at appnel.com> wrote:
> Meaning null or '' or 0? Yes. Meaning an array refeence with zero
>  elements? No. Not with mt:if in that position though I think the loop
>  would never start if coo_loops was a reference to an empty array
>  reference.
>
>  Anyway, the mt:if statement and others follows the standard Perl
>  evaluation of true and false values. Null, '' (blank string) or 0
>  (zero) is false and everything else is true.
>
>
>
>  <tim/>
>
>  --
>  Timothy Appnel
>  Appnel Solutions
>  http://appnel.com/
>



-- 
Steve Ivy
http://redmonk.net // http://diso-project.org
This email is: [ ] bloggable [x] ask first [ ] private


More information about the MTOS-dev mailing list