View previous topic :: View next topic |
Author |
Message |
metheorn Smarty Rookie
Joined: 22 Aug 2003 Posts: 14
|
Posted: Fri Aug 22, 2003 1:01 pm Post subject: Problem w<ith {if} statement |
|
|
Hello,
It's seems that i can't use variable from an array in a if statement
Code: |
{section name=i loop=$agences}
{if {$agence[i].GrpNom} == "XXX" }
|
This code don't work. It returns always true.
Someone has an idea ? |
|
Back to top |
|
mocean Smarty Rookie
Joined: 21 May 2003 Posts: 30 Location: The Netherlands
|
Posted: Fri Aug 22, 2003 1:24 pm Post subject: Re: Problem w<ith {if} statement |
|
|
metheorn wrote: | Hello,
It's seems that i can't use variable from an array in a if statement
Code: |
{section name=i loop=$agences}
{if {$agence[i].GrpNom} == "XXX" }
|
This code don't work. It returns always true.
Someone has an idea ? |
Have you tried
Code: |
{section name=i loop=$agences}
{if agence[i].GrpNom == "XXX" }
|
? _________________ Visit My Smarty Enabled Website (Dutch Only) at www.habiforum.nl
and read how it works. |
|
Back to top |
|
metheorn Smarty Rookie
Joined: 22 Aug 2003 Posts: 14
|
Posted: Fri Aug 22, 2003 1:32 pm Post subject: |
|
|
Here is the result with {if agence[i].GrpNom == "XXX" }
Code: | syntax error: unidentified token '[i].GrpNom' (Smarty_Compiler.class.php, line 1228) |
With
Code: | {section name=i loop=$agences}
{if {$agence[i].GrpNom} == "FRANTOUR" }
|
The source page returns
|
|
Back to top |
|
andre Smarty Pro
Joined: 23 Apr 2003 Posts: 164 Location: Karlsruhe, Germany
|
Posted: Fri Aug 22, 2003 1:49 pm Post subject: |
|
|
mocean did a small typo: Do not forget the "$" at the beginning of your variable!
Therefore it should look like this:
Code: | {section name=i loop=$agences}
{if $agence[i].GrpNom == "XXX" } |
|
|
Back to top |
|
metheorn Smarty Rookie
Joined: 22 Aug 2003 Posts: 14
|
Posted: Fri Aug 22, 2003 2:18 pm Post subject: |
|
|
Cela ne fonctionne toujours pas.
Cette fois ci, le résultat renvoie toujours FALSE ... |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Fri Aug 22, 2003 2:30 pm Post subject: |
|
|
$agences != $agence |
|
Back to top |
|
metheorn Smarty Rookie
Joined: 22 Aug 2003 Posts: 14
|
Posted: Fri Aug 22, 2003 2:37 pm Post subject: |
|
|
Arrrrhhhh......
What a mistake
thanks a lot, it's work |
|
Back to top |
|
andre Smarty Pro
Joined: 23 Apr 2003 Posts: 164 Location: Karlsruhe, Germany
|
Posted: Mon Aug 25, 2003 6:23 am Post subject: |
|
|
Sorry |
|
Back to top |
|
|