Monday, 2 November 2009

Articles on PHP template recognition by Smarty

Is Smarty it? Smarty is a template engine for PHP. If more detailed,
Smarty provides facilities to manage the separation of application logic and content
of presentation. This is well illustrated in which the application programmer
and designers have a different role, where in most cases not
is the same person. For example, suppose you create a web page
which displays a newspaper article.

Article title, author and body are content elements, they do not contain
information on how they will be represented. They were transferred to Smarty
by the application and the template designer template editing and using a combination
HTML tags and template tags to format the presentation of these elements (table
HTML, background color, font size, style sheets). Then one day a programmer
need to change how the contents of the article obtained. This change does not affect
template designer, because the contents of the article can be obtained on the template as
previously. Then just as if the template designer to change design
the application logic does not need to be changed at all,

Unique mechanism of Smarty is the template compiling process. This means
Smarty template file read and create PHP scripts from it. Once they
made, they will run so there is no waste of time and resources
power for template parsing for each request. Templates can also take advantage
PHP compiler cache advantages such as Zend Accelerator or PHP Accelerator.

Some advantages and facilities Smarty:

- Very fast

- Efficient because the program is processed as usual by PHP PHP Parser

- There is no template parsing because it is compiled only once

- Smart because recompilation happens automatically when the template file changes

- You can create own functions and variable modifiers, so the use of their own
template can be developed more extensive

- Syntax template that can be configured, you can use (), {{}},


- Structure of if / elseif / else / endif dipass to the PHP parser, so the expression (if ..)
can be used in simple or complex shapes

- No restrictions-story section

- We can insert PHP code in template files, although this may
not required

- Facilities built in caching

- Arbitrary template sources

- Cache handling function that can be made alone

- Architecture plugin

Further information can be obtained at http://smarty.php.net

5 comments: