ready-to-use resources, tutorials, tips and many other web development related stuff
WARNING! You probably have JavaScript disabled. Some features of this site will not work properly unless JavaScript enabled. changed to

Smarty: PHP Template Engine

Smarty is a template engine for PHP. More specifically, it facilitates a manageable way to separate application logic and content from its presentation. This is best described in a situation where the application programmer and the template designer play different roles, or in most cases are not the same person.

One of the unique aspects about Smarty is the template compiling. This means Smarty reads the template files and creates PHP scripts from them. Once they are created, they are executed from then on. Therefore there is no costly template file parsing for each request.

Some of the Smarty’s features

  • It is extremely fast.
  • It is efficient since the PHP parser does the dirty work.
  • No template parsing overhead, only compiles once.
  • It is smart about recompiling only the template files that have changed.
  • You can easily create your own custom functions and variable modifiers, so the template language is extremely extensible.
  • Configurable template {delimiter} tag syntax, so you can use {$foo}, {{$foo}}, <!–{$foo}–>, etc.
  • The {if}..{elseif}..{else}..{/if} constructs are passed to the PHP parser, so the {if…} expression syntax can be as simple or as complex an evaluation as you like.
  • Allows unlimited nesting of sections, if’s etc.
  • It is possible to embed PHP code right in your template files, although this may not be needed (nor recommended) since the engine is so customizable.
  • Built-in caching support.
  • Arbitrary template sources.
  • Custom cache handling functions.
  • Plugin architecture.

Smarty Template Engine

Comments are closed.

© 2008 - 2022, | Powered by Wordpress | Theme by Elegant Themes | Valid XHTML and CSS | Subscribe to RSS