Re: How do I evaluate this?

From: Date: Fri, 15 Mar 2002 17:49:58 +0000
Subject: Re: How do I evaluate this?
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-3090@lists.php.net to get a copy of this message
Does it give an error, or just evaluate wrong? If you remove the "|truncate:2" part, does that do something different? "Jan H. Andersen" wrote: > > >Get rid of the nested brackets. > > I tried that too, but it didn't work. The entire section of code look like > this: > > {section name=standard loop=$moduledata_custommenu_main} > {if $moduledata_custommenu_main[standard].url <> > ""}"TEXT:{$moduledata_custommenu_main[standard].description}" "{if > $moduledata_custommenu_main[standard].parent == 0}1{else}{if > $moduledata_custommenu_main[standard].description|truncate:2 == > "--"}2{else}-1{/if}{/if}" "1" > "LINK:{$moduledata_custommenu_main[standard].url},content" "" > {/if} > {/section} > > Sorry about the messy code... It writes a textfile for a menu-applet, with > one line per menu entry. > > Best Regards > > Jan H. Andersen > > -----Oprindelig meddelelse----- > Fra: mohrt@ns3.ispi.net [mailto:mohrt@ns3.ispi.net]Pa vegne af Monte > Ohrt > Sendt: 15. marts 2002 18:26 > Til: smarty@lists.ispi.net > Cc: smarty@lists.ispi.net > Emne: [smarty] Re: How do I evaluate this? > > Get rid of the nested brackets. > > {if $myvar|truncate:2 eq "--"}2{else}-1{/if} > > "Jan H. Andersen" wrote: > > > > I need to do something like this: > > > > {if {$myvar|truncate:2} eq "--"}2{else}-1{/if} > > > > As far as I know, I cant write it like this in Smarty. When $myvar > contains > > "--" as the first 2 characters I want to print "2" else "1". > > > > How can I make such an evaluation? > > > > Best Regards > > > > Jan H. Andersen > > > > --- > > You are currently subscribed to smarty as: monte@ispi.net > > To unsubscribe send a blank email to $subst('Email.Unsub') > > Visit Smarty's homepage at > > http://www.phpinsider.com/php/code/Smarty/ > > -- > Monte Ohrt <monte@ispi.net> > Director of Technology, ispi Inc. > > --- > You are currently subscribed to smarty as: jha@sjovide.dk > To unsubscribe send a blank email to $subst('Email.Unsub') > Visit Smarty's homepage at > http://www.phpinsider.com/php/code/Smarty/ > > --- > You are currently subscribed to smarty as: monte@ispi.net > To unsubscribe send a blank email to $subst('Email.Unsub') > Visit Smarty's homepage at > http://www.phpinsider.com/php/code/Smarty/ -- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.

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