Re:Arguments for Smarty!
| From: | Brian E . Lozier | Date: | Wed, 19 Dec 2001 10:38:36 +0000 |
| Subject: | Re:Arguments for Smarty! | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-2337@lists.php.net to get a copy of this message | ||
Ugh :(
I find that most people don't bother with a templating system simply because they're lazy.
Even if you can
convince them that it's a better way to go, generally it still doesn't change their mind.
Templating a large
system results in increased programming time (at least for me). What they don't realize is the
benefits
later on. I'm not going to post on their forum, but here's a response I posted earlier
this month in
response to a similar question. Not directly applicable, but it shows why I will never again create
a non-
templated system.
--
I don't understand this conversation. The language built into Smarty is designed to manipulate the OUTPUT.
What the user sees. It's not designed to handle things like adding or removing information from a database.
It's not designed for user authentication. It's not designed to allow the programming of a shopping cart
application, or an online photo album. It's not designed to generate images, or parse XML files.
Template engines are designed to separate the application logic from the output, simple as that. The logic
that Smarty allows is powerful enough that the DESIGNERS can have complete control over how the web site
looks, without having to delve into my PHP files. They don't have to worry about database access or input
verification. They only work on the design! The logic in there can be used for things like displaying a
login box if they're not logged in, or a confirmation if they are. It can be used to iterate over a
recordset, but guess what? The designers don't care! They code (in HTML) the way the table should look, and
the programmers are in charge of making sure the data gets there.
What's more, in my application, at least, I can give the designers complete access to the /templates folder,
and they can do whatever they want to the design, and they never have to look at the PHP. They can change
the entire look of the site by modifying a few templates. If you were using a straight PHP implementation,
you'd have to go back and modify every single solitary PHP file on your site. In the end, I will have dozens
of PHP pages, but to change the look of the site... guess what? I just have to get the designers to modify
main.tpl.
For me, it took programming w/out a template engine for a while to understand the point and the beauty of
them. I went from embedding my HTML in my php pages to fast templates, to phplib templates, and finally, to
Smarty. If you can't see the benefits of a template engine, don't use one! Eventually, you'll see the need,
and if your site turns out to have as many pages as mine does (7000+), you'll SERIOUSLY wish you had used
templates originally (believe me, I'm still regretting not using templates... but at least I have an excuse:
I didn't even know wtf a template was!).
--
Brian
------------------------------------
"How should I know if it works? That's what beta testers are for. I only coded it." -
Linus Torvalds
----- Original Message -----
From: Andreas Heintze <andreas.heintze@home.se>
To: smarty@lists.ispi.net
Date: 12/19/01 2:31:48 AM
>
>Hi!
>
>Seems like the phpshop guys have left Smarty out, unless
>someone can convince them to take up that thread again!
>Can someone please explain why Smarty is better than using
>PHP mixed with HTML.
>
>http://www.phpshop.org/forums/viewtopic.php?
>topic=1437&forum=10&start=10
>
>About the loops in Smarty, the foreach is a good and easier
>alternative to sections when it comes to single arrays.
>Can multidim.arrays be done easier somehow??
>
>/Andreas
>
>
>---
>You are currently subscribed to smarty as: brian@massassi.net
>To unsubscribe send a blank email to $subst('Email.Unsub')
>Visit Smarty's homepage at
>http://www.phpinsider.com/php/code/Smarty/