Subject:*
<
Name/Email:*
<
Message Icon:*
<
Select*
<
Message:*
<



Click the Preview to see the content in action.
Options:*
<
Confirmation Code*
<
3 + 3 = ?  
Input the result from the expression
Maximum attempts you can try: 10
*
<
   

Re: problem with smarty and logical operators
by christian on 2005/5/22 23:25:11

Thousand thanks Dave, it's ok now
Re: problem with smarty and logical operators
by Dave_L on 2005/5/22 23:07:54

Quote:
<{if substr($article.headline,1,4) != "Menu"}>


This works for me. Note that substr(...,1,4) returns four characters starting at the second character of the string. For example, substr("abcdef",1,4) is "bcde".

Quote:
<{if $article.headline != "Saveurs régionales" or $article.headline != "Menu de saison"}>


This also works. But it doesn't make much sense, since the if-clause will always be true. I.e., if A != B, as they are in your case, then the expression (C != A or C != B) is a tautology (always true).
Re: problem with smarty and logical operators
by christian on 2005/5/22 20:23:34

I have the same problem with wfchannel_index.html.

This is ok
<{if $article.headline != "Saveurs régionales"}>
<{$article.headline}>
<{/if}>

But this lines are not implemented

<{if substr($article.headline,1,4) != "Menu"}>

<{if $article.headline != "Saveurs régionales" or $article.headline != "Menu de saison"}>

Have you a idea ?
Re: problem with smarty and logical operators
by Maxter on 2004/10/12 16:53:34

thanks for the answers...

Mithrandir:
yes, the Slink.logourl is a typo in the post, i checked many times the syntax :)
before posting i also tried to separate the condition with bracket, without any result :-/

Draven:
i tried also the use of OR instead of ||, again without any result, and i have read the smarty documentation many times searching for any possible idea.

I will try to reproduce this error in another page containing only the $link array or another array, to see it the error happen again.
Re:problem with smarty and logical operators
by Draven on 2004/10/12 15:44:57

Also be sure to check the smarty doc site for proper use of the || operator, my suggestion would be to use OR instead.

http://smarty.php.net/manual/en/language.function.if.php

Quote:

{* an example with "or" logic *}
{if $name eq "Fred" or $name eq "Wilma"}
...
{/if}

{* same as above *}
{if $name == "Fred" || $name == "Wilma"}
...
{/if}

{* the following syntax will NOT work, conditional qualifiers
must be separated from surrounding elements by spaces *}
{if $name=="Fred" || $name=="Wilma"}
...
{/if}

Who's Online

233 user(s) are online (174 user(s) are browsing Support Forums)


Members: 0


Guests: 233


more...

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits