Smarty (template engine)
Smarty is a web template system written in PHP. Smarty is primarily promoted as a tool for separation of concerns, and is intended to simplify compartmentalization, allowing the front-end of a web page to change separately from its back-end. Ideally, this lowers costs and minimizes the efforts associated with software maintenance. Smarty generates web content through the placement of special Smarty tags within a document. These tags are processed and substituted with other code. Tags are directives for Smarty that are enclosed by template delimiters. These directives can be variables, denoted by a dollar sign ($), functions, logical or loop statements. Smarty allows PHP programmers to... Source: e01 Encyclopedia. Licence: CC BY-SA 4.0.
Smarty is a web template system written in PHP. Smarty is primarily promoted as a tool for separation of concerns, and is intended to simplify compartmentalization, allowing the front-end of a web page to change separately from its back-end. Ideally, this lowers costs and minimizes the efforts associated with software maintenance. Smarty generates web content through the placement of special Smarty tags within a document. These tags are processed and substituted with other code. Tags are directives for Smarty that are enclosed by template delimiters. These directives can be variables, denoted by a dollar sign ($), functions, logical or loop statements. Smarty allows PHP programmers to define custom functions that can be accessed using Smarty tags. {$title_text|escape} {* This is a little comment that won't be visible in the HTML source *} {$body_html} The PHP business logic to use the Smarty template above could be: define('SMARTY_DIR', 'smarty-2.6.22/'); require_once(SMARTY_DIR . 'Smarty.class.php'); $smarty = new Smarty(); $smarty->template_dir = './templates/'; $smarty->compile_dir = './templates/compile/'; $smarty->assign('title_text', 'TITLE: This is the Smarty basic example ...'); $smarty->assign('body_html', ' BODY: This is the message set using assign() '); $smarty->display('index.tpl'); ==Further reading== ==References== ==External links==
Cite this
"Smarty (template engine)". 1786777479. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1369491741 JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy