I use Dreamweaver, is Edit-X right for me?
If you like full control over your web site then Edit-X is for you. You can use Dreamweaver to edit the Smarty template files to customize the look and feel any way you like.
Smarty is a "Template Engine". 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. Smarty is a simple tag-replacing template engine and much more. 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.
What does this mean to a Designer?
Smarty will allow you easily customize the HTML within the Edit-X software. You will have 100% control over the HTML displayed to the browser. You may not be familiar with S
marty as the name but you have probably already used in other PHP web-based software such as PHP BB forums.
What does this mean to a Developer?
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 d
esigner 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.
Why use Edit-X and Smarty?
- 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.
If you can recognized the variables in blue below then you can edit Smarty templates. By modifying the HTML around the variables you can adjust the layout without modifying any PHP code.
| index.tpl | | output |
User Info
User Information:
Name: {$name}
Address: {$address}
|
|
User Info
User Information:
Name: george smith
Address: 45th & Harris
|
One of Smartys primary design goals is to facilitate the separation of application code from presentation. Typically, the application code contains the business logic of your
application, written and maintained in PHP code. This code is maintained by programmers. The presentation is the way your content is presented to the end user, which is written
and maintained in template files. The templates are maintained by template designers.
Although application code is separated from presentation, this does not necessarily mean that logic is separated. The application code obviously has logic, but the templates may have logic based on the condition that it is for presentation only. For example, if the designer wants to alternate table row colors or upper-case some assigned content, they can. This is presentation logic, something the programmer should not be concerned with. How often have you had some presentation displayed in a single column and then you wanted it in two or three columns, so the application code needs adjusting to accomodate this? A better approach is to assign the content in one single array and let the template handle the presentation. This will simplify your application and keep your templates flexible. Smarty supplies the tools to handle this kind of situation.
Some Smarty Resources
Smarty Documentation - A complete guide to everything Smarty.
Smarty Crash Course - For those of you who have used PHP template engines, the basic concepts of Smarty should look quite familiar. In your PHP application you assign variables for use in the template, then you display it.
SmartyDWT - SmartyDWT is a Macromedia Dreamweaver MX and MX 2004 extension. Its main purpose is to simplify editing Smarty based templates in Dreamweaver. Smarty is a very popular open source template engine based on PHP. It is fast, stable, extendable, easy to use and comes with a lots of useful features.