What the OP seems to be looking for is one of many MVC infrastructures that separate the program logic from the display logic and make Smarty more understandable.
MVC stands for Model View Controller and is the so-called pseudo-design pattern. This is a way to clearly encode your application logic and have only minimal output code in the template files.
The model refers to the logic of the database (or some other data warehouse). Part of the controller is what is used to talk to the Model, and provide data for the View output. Smarty templates can be used as a View component quite well, and Smarty has its own syntax for use with PHP.
There are many MVC-like frameworks such as Zend , CakePHP, and Kohana . Also, check out the Smarty Template Engine or, alternatively, ExpressionEngine .
For more information on MVC, refer to Wikipedia - Model-view-controller .
source share