Using Smarty - Template Engine
Posted on April 14th, 2007 | |
Many of the new development projects I am working on now involves the use of smarty (with file extension *.tpl). Smarty is also used on modern cms applications such as Xcart, Serendipity, etc.
What is a Smarty?
Although Smarty is known as a “Template Engine”, it would be more accurately described as a “Template/Presentation Framework.” That is, it provides the programmer and template designer with a wealth of tools to automate tasks commonly dealt with at the presentation layer of an application. I stress the word Framework because Smarty is not a simple tag-replacing template engine. Although it can be used for such a simple purpose, its focus is on quick and painless development and deployment of your application, while maintaining high-performance, scalability, security and future growth. [source]
Using Smarty is very helpful if you are developing large scale websites because of its ability to provide a robust templating framework with numerous tools to assist you as your application evolves into the future.
Here are some good reasons to use Smarty in developing sites
- Designers can’t break application code. They can mess with the templates all they want, but the code stays intact. The code will be tighter, more secure and easier to maintain.
- Errors in the templates are confined to the Smartys error handling routines, making them as simple and intuitive as possible for the designer.
- With presentation on its own layer, designers can modify or completely redesign it from scratch, all without intervention from the programmer.
- Programmers aren’t messing with templates. They can go about maintaining the application code, changing the way content is acquired, making new business rules, etc. without disturbing the presentation layer.
- Templates are a close representation of what the final output will be, which is an intuitive approach. Designers don’t care how the content got to the template. If you have extraneous data in the template such as an SQL statement, this opens the risk of breaking application code by accidental deletion or alteration by the designer.
- You are not opening your server to the execution of arbitrary PHP code. Smarty has many security features built in so designers won’t breach security, whether intentional or accidental. They can only do what they are confined to in the templates.
To learn more about Smarty, check out this basic Crash Course on how to use it. You may also check this list of applications using Smarty here.
Related posts:
- Social Web Hosting Network
- Home-based Programmer
- Google Developer Day 2007
- Fifty Ways to Become a Better Designer
- Great careers you can do from home
- Internet Consulting Services
- Why is On Page Optimization Important?
- Using CSV
- Platinax Business Forum
- 20 Professional Web Design Tips





Leave a Reply