Smarty (template engine)
Smarty is a web template system written in PHP.[src] 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.[src] Ideally, this lowers costs and minimizes the efforts associated with software maintenance.[src] Smarty generates web content through the placement of special Smarty tags within a document.[src] These tags are processed and substituted with other code.[src] Tags are directives for Smarty that are enclosed by template delimiters.[src] These directives can be variables, denoted by a dollar sign ($), functions, logical or loop statements.[src] Smarty allows PHP programmers to define custom functions that can be accessed using Smarty tags.[src]
Smarty is a web template system written in PHP.[src] 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.[src] Ideally, this lowers costs and minimizes the efforts associated with software maintenance.[src] Smarty generates web content through the placement of special Smarty tags within a document.[src] These tags are processed and substituted with other code.[src] Tags are directives for Smarty that are enclosed by template delimiters.[src] These directives can be variables, denoted by a dollar sign ($), functions, logical or loop statements.[src] Smarty allows PHP programmers to define custom functions that can be accessed using Smarty tags.[src] {$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 .[src] '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==[src]
18 sentences · 18 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Smarty (template engine)." encyclopegia.org, 2026, https://encyclopegia.org/wiki/smarty-template-engine. Accessed 30 November 2026.
Chicago
"Smarty (template engine)." encyclopegia.org. Accessed November 30, 2026. https://encyclopegia.org/wiki/smarty-template-engine.
APA
encyclopegia.org. (2026). Smarty (template engine). Retrieved November 30, 2026, from https://encyclopegia.org/wiki/smarty-template-engine
Accessed November 30, 2026 · CC BY-SA 4.0 · citation page · JSON