Using Smarty – Template Engine
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.
Check my other posts:
- 5S – Seiri, Seiton, Seiso, Seiketsu, Shitsuke
5S is a method to reduce waste and optimise productivity... - Google Developer Day 2007
Tonight I went to ACCEED Conference Center, Makati City to... - Withdraw PayPal to Philippine Banks
1st Update: I can’t add my bank right now, I... - Change .php to .html using .htaccess or httpd.conf
It is common that when a site already has so... - How to rank on searches from specific countries
Here are some tips on how your site can rank... - Why is on page optimization important?
There are two ways of optimizing a website: on-page and... - Obama Condemns North Korea’s Missile Tests
The world was taken by surprise when Pyongyang tested two... - FireFox Add-ons as SEO Tools
If you are looking for free SEO tools, you can... - How to display javascript on top of flash
Ever had that experience where your javascript is shown behind...
Leave a Reply