Re: Re[2]: [SMARTY] switch statement ?
| From: | Jason Sweat | Date: | Mon, 29 Apr 2002 12:10:53 +0000 |
| Subject: | Re: Re[2]: [SMARTY] switch statement ? | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-3921@lists.php.net to get a copy of this message | ||
I would be in favor of including a switch statement if it did not add to the
runtime overhead for Smarty.
The template at http://www.zend.com/zend/tut/tutsweatpart2.php#Heading14b
includes an {if} {elseif} {elseif} {/if} structure for displaying the
various views. This comes from my personal preference to maintain a single
source and a single template file. (I have thought on occasion that this is
a belief I should review in light of PHP's conditional include capability,
but I have not seen sufficient documentation on the benefits of multiple
smaller disk access reads vs. a single larger read, particularly under a PHP
accelerator.)
Jason
----- Original Message -----
From: "Bertrand DUNOGIER" <bdunogier@wanadoo.fr>
To: "Rasmus Mohr" <rmo@Netpointers.com>
Cc: <smarty-general@lists.php.net>
Sent: Monday, April 29, 2002 4:20 AM
Subject: Re[2]: [SMARTY] switch statement ?
> RM> Why do you want to stuff a lot of functionality into the templates? It
seems
> RM> to me that it would be a bad case of mixing the functionality and
> RM> presentation layer.
>
> RM> A lot of the requests on this list seems to be aimed at getting more
and
> RM> more functionality into the template system (e.g. the PDF discussion).
I
> RM> regard this as very wrong - you'll end up putting developer/designer
layer
> RM> on top of PHP, and then you'll need a new layer on top of Smarty, to
provide
> RM> the designers with a (somewhat) clean interface...
> I'm not a begginer programmer, you know :)
>
> I just notice that i happen to have some
> {if ...}
> ...
> {elseif}
> ...
> {elseif}
> ...
> {else}
> ...
> {/if}
> statements. And this is typically what can be replaced by a switch
> with a good increase in code quality.
>
> And since this is handled on template compilation time, it doesn't
> harm the site's response time.
>
> But never forget that in my opinion, this is not something that html
> designers can handle easily. On the other hand, html designers can't
> be full templates designer unless they have some coding knowledges,
> so...
>
> and a switch / case is not harder to understand than a if / elseif /
> else is it ? :)
>
> Thougts ?
>
> Bertrand
>
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>