Re: [SMARTY] switch statement ?
| From: | Ivo Jansch | Date: | Mon, 29 Apr 2002 14:46:23 +0000 |
| Subject: | Re: [SMARTY] switch statement ? | ||
| References: | 1 2 3 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-3925@lists.php.net to get a copy of this message | ||
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