Fw: [SMARTY] switch statement ?
| From: | Roberto Bertó | Date: | Tue, 30 Apr 2002 16:20:58 +0000 |
| Subject: | Fw: [SMARTY] switch statement ? | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-3935@lists.php.net to get a copy of this message | ||
I agree to Ivo. Switch is usefull.
Maybe if you are too care about Smarty performace, you should add the
control strucure Switch like a plugin. First of all Smarty search for
{switch. If found, load the compile plugin.
I dont know what is better to keep the performace, but was only a
suggestion.
Andrei, I have a question: if I have an array $customer =
array(3=>"A",4=>"B") and {section name=customer loop=$custid}id:
{$custid[customer]}<br>{/section} we will not get the right output, right?
> ----- Original Message -----
> From: "Ivo Jansch" <ivo@ibuildings.nl>
> To: <smarty-general@lists.php.net>
> Sent: Monday, April 29, 2002 11:46 AM
> Subject: Re: [SMARTY] switch statement ?
>
>
> > Hi,
> >
> > Andrei Zmievski wrote:
> >
> > > Why? Is it an axiom that switch/case leads to inherently better code
> > > quality than an if/else chain?
> >
> > I can think of a lot of situations where that would be the case,
> > especially when dealing with layout:
> >
> > <td bgcolor="#{switch $menu}
> > {case "main"}blue
> > {case "help"}white
> > {case "about"}red
> > {/switch}>
> >
> > looks cleaner than:
> >
> > <td bgcolor="#{if $menu=="main"}blue
> > {elseif $menu=="help"}white
> > {elseif $menu=="about"}red
> > {/if}>
> >
> > > mind, and the less code constructs we have, the better off Smarty is.
> >
> > If it is a plugin, it wouldn't bother anyone who doesn't like to use it,
> > would it?
> >
> > Greetings,
> > Ivo
> > --
> > Ivo Jansch <ivo@ibuildings.nl>
> > ibuildings.nl BV - information technology
> > http://www.ibuildings.nl
> >
> >
> >
> >
> > --
> > Smarty General Mailing List (http://smarty.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> >
>