Re: if in section
| From: | Monte Ohrt | Date: | Mon, 19 Feb 2001 16:56:45 +0000 |
| Subject: | Re: if in section | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-148@lists.php.net to get a copy of this message | ||
lexa wrote:
>
> Hello Monte,
>
> Monday, February 19, 2001, 5:55:58 PM, you wrote:
>
> MO> absolutely! be sure to use the correct syntax though, in your example it
> MO> looks as if you should use a slash instead of a period. All three of
> MO> these examples should work identical, it is just a matter of your syntax
> MO> preference:
>
> 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.
If b_active is an array, then comparing it with "1" will not get the
results you intended. Are you wanting to compare the number of elements
in the array? If so, try this:
{if count($service/b_active) eq 1}
>
> --
> Best regards,
> lexa mailto:lexa@indi.ru
--
Monte Ohrt <monte@ispi.net>
http://www.ispi.net/