Re: [SMARTY] smarty templates vs. php templates
| From: | Matthew Weier O'Phinney | Date: | Wed, 06 Apr 2005 02:14:34 +0000 |
| Subject: | Re: [SMARTY] smarty templates vs. php templates | ||
| References: | 1 2 3 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-12412@lists.php.net to get a copy of this message | ||
* David Ngo <dngo@getlisa.com>:
> We are not talking about building a new template system here. What
> they are proposing is just using html/php as a template which will be an
> include file. We would also then have to come up with our own functions
> for displaying listboxes, radio buttons, tables etc. Yes that sounds a
> lot like Smarty, but the argument is that they would not have to learn
> Smarty that way and the php/html templates would be much simpler since
> everyone at work knows php but I'm the only one that knows Smarty.
<snip>
> I know that it makes my coding easier and I can pretty much cut and
> paste presentation logic at will but this is not the hard physical
> evidence my boss is requiring me to come up with . We have had
> problems a few times because the designer was designing
> header/navigation/footer templates in plain php/html and I had the
> same templates for myself in Smarty. This caused some navigation links
> and pictures to be inconsistent since some pages would call different
> templates.
There are several important arguments here; often a business cannot
afford to pay its developers to learn (sad, but true -- fortunately, I
don't work for one of them!).
Now, sometimes, a small amount of learning on the part of one or more
individuals can greatly aid productivitiy, and thus reaps rewards for
the business. This can't be overlooked, either.
Where I work, we were going the route your boss and co-workers are
suggesting, hand-rolling our own tools and doing everything at a very
low level, php-wise. However, we were each doing it our own way. This
caused issues in and of itself -- no internal standards, each of us
trying to figure out a faster, better way of doing things. Templates
existed per application, but with little sitewide cohesion (and
including the sitewide templates was often a dicey situation -- the
placement within the code had to be very well thought out).
This is where Smarty came in (as well as OOP, as well as a class I
ported from perl, Cgiapp). Smarty:
* Allowed us to separate presentation from application
* Which in turn allowed us to pass on the presentation layer to our
editors, freeing us up for more development
* Helped us standardize on the process of presentation/application logic
* Helped educate us on the benefits of using PEAR::DB's get* macros (in
conjunction with Smarty, they've saved us hundreds of work hours and
countless lines of code)
Smarty was new to all of use when we adopted it, as were the tools we
started using at the same time. As a result, we were able to form a
standard development framework for ourselves that has allowed us to
significantly increase our rate of development as well as to tackle new
projects.
It's possible we could have come up with our own tools to do this
(indeed, Cgiapp was one such tool) -- but using Smarty and PEAR (and
PEAR's coding standards) gave us a starting point that we could point to
and start running with.
Yes, everybody has to learn.... but if everybody agrees to learn, and to
follow the same standards, much may be gained. Keep an open mind
yourself -- the tools of your coworkers may actually be the best route
for the company you work for, and you may find they help your own
productivity. At the same time, don't let them bully you into using
their tools simply because *they* don't want to learn something new;
programming is a constant learning process.
--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:matthew@garden.org | http://vermontbotanical.org