Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

How Smarty help PHP

Post new topic   Reply to topic    Smarty Forum Index -> Frameworks
View previous topic :: View next topic  
Author Message
Smarty n00b

Joined: 26 May 2007
Posts: 1

PostPosted: Sat May 26, 2007 7:03 am    Post subject: How Smarty help PHP Reply with quote

Hi Friend
I want to know your opinion regarding how Smarty help to boost the performance with PHP?

And also what is the basic difficulties may arise when a developer will use it for first time ?

Back to top
View user's profile Send private message Send e-mail
Smarty Pro

Joined: 16 May 2007
Posts: 124
Location: Italy

PostPosted: Sat May 26, 2007 7:22 am    Post subject: Reply with quote

Smarty helps create a logical separation between the business logic and presentation.

It means you don't have to worry as much in your PHP about how information is displayed - leaving that instead to smarty templates.

It boost productivity by allowing reuse of smarty templates and plugins and allows, for projects involving teams of people, people to focus on what they are good at. Designers focus on design - developers focus on logic, processing and storage.

Problems with using smarty for the first time:

1) Don't be over-ambitious - keep your first attempts simple and build upon what you learn

2) While the smarty synatx isn't difficult - it's different from what you might be used to. Understand how it works and why it works the way it does (a good example is escaping variables, the use of backticks, smarty functions & plugins, etc)

3) Resist the urge to put display logic into the business layer. This isn't as easy as it appears:

3.1) People are used to doing things in a particular way - so if you're used to writing HTML tags in PHP you'll find it a hard habbit to break

3.2) Sometimes you need to provide hints to smarty when you want to create something generic. An example is displaying a table. A table is something pretty generic - so it's something that you want to write a single template for and reuse. Where does the information for the columns come from? What about action columns (those that allow deleating, editing, etc)? These kinds of situations you kind of fall into (ie they sneak up on you) - when you start finding yourself in one. Solve the problem and then take a look at what you've done and ask yourself if you've done it in the best way or what else might creap out of the woodwork. By taking a pause and re-analysing what you've done you may find that you can change a few things and make it simpler or more reusable.
General Blog:
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Frameworks All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP