Re: if in section

From: Date: Mon, 19 Feb 2001 17:11:03 +0000
Subject: Re: if in section
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-149@lists.php.net to get a copy of this message
lexa wrote: > > Hello Monte, > > Monday, February 19, 2001, 7:56:45 PM, you wrote: > > >> MO> {if ($service/b_active == 1)} > >> MO> {if $service/b_active == 1} > >> MO> {if $service/b_active eq 1} > >> I've tried this solution already but due to my coding style I was > >> unable to get right result. > >> > >> Then condition sign == is separated from variable by space everything > >> goes alright. But than you try to remove spaces errors like these > >> -- cut -- > >> Warning: Division by zero in /www-koi8r/htdocs/compiled_templates/cl_services.html.php > >> on line 3 > >> -- cut -- > >> occur because of zero values in $b_active array. > >> Guess I've found little bug in parser. > > MO> If b_active is an array, then comparing it with "1" will not get the > MO> results you intended. Are you wanting to compare the number of elements > MO> in the array? If so, try this: > MO> {if count($service/b_active) eq 1} > $b_active is array but I don't want it size in section loop. > I mean that > {if ($service/b_active == 1)} and > {if ($service/b_active==1)} give different results. Ah yes. All conditional qualifiers must be separated from surrounding elements with spaces. This is a requirement of the tokenizer. We'll clarify this in the manual. > > -- > Best regards, > lexa mailto:lexa@indi.ru -- Monte Ohrt <monte@ispi.net> http://www.ispi.net/

« previous php.smarty.general (#149) next »