TinyButStrong
From Wikipedia, the free encyclopedia
TinyButStrong is a template engine written in PHP. Programmers and web developers may use it for Web development. TinyButStrong is a PHP class that separates PHP from HTML. It does not work like Smarty or vlibTemplate, which allow IF statements and create blocks like WHILE in PHP.
[edit] Code example
Since TinyButStrong separates PHP from HTML, you have two files:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html> <head> <title>[var.title_text]</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> </head> <body> <p>[var.body_text]</p> </body> </html>
As you can see this file contains plain HTML and the template variable "[var.body_text]". In contrast to other template engines the PHP script does not contain methods like "assign". All global PHP variables can be used in the template (an option can limit the access of global variables from the template):
require_once 'tbs/tbs_class.php'; $tmpl = new clsTinyButStrong; $tmpl->LoadTemplate('tmpl/basic.htm'); $title_text = 'TITLE: This is the TBS basic example ...'; $body_text = 'BODY: This is the message using TinyButStrong template engine.'; $tmpl->Show();