FXL Template is an easy to use template engine that covers all the basic features of a template system. It supports simple text/array assignments, blocks and nested blocks. Well- used regular expressions and the simple markup are responsible for quick rendering. The template markup is really easy to learn - even for people not into programming. Everything can be done with just two types of place holders. For high traffic enviroments you are invited to test our "memcached" cache extension.
hello world example:
Template (example.tpl)
{greeting}
PHP-Code (demo.php)
require_once 'fxl_template.inc.php';
$fxlt = new fxl_template('example.tpl');
$fxlt- >assign('greeting', 'hello world!');
$fxlt- >display;
Output
hello world!
more complex example:
Template (example.tpl)
< table >
< !-- START row -- >
< tr >
< !-- START cell -- >< td >{td_value}< /td >< !-- END cell -- >
< /tr >
< !-- END row -- >
< /table >
PHP-Code (demo.php)
require_once 'fxl_template.inc.php';
$fxlt = new fxl_template('example.tpl');
$fxlt_row = $fxlt- >get_block('row');
$fxlt_cell = $fxlt_row- >get_block('cell');
for ($tr = 1; $tr < = 3; $tr++) {
for ($td = 1; $td < = 3; $td++) {
$fxlt_cell- >assign('td_value', $tr.':'.$td);
$fxlt_row- >assign('cell', $fxlt_cell);
$fxlt_cell- >clear();
}
$fxlt- >assign('row', $fxlt_row);
$fxlt_row- >clear();
}
$fxlt- >display();
Output
< table >
< tr >
< td >1:1< /td >< td >1:2< /td >< td >1:3< /td >
< /tr >
< tr >
< td >2:1< /td >< td >2:2< /td >< td >2:3< /td >
< /tr >
< tr >
< td >3:1< /td >< td >3:2< /td >< td >3:3< /td >
< /tr >
< /table >
Product's homepage
Requirements:
· PHP 5.1 or later
· Memcache extension
· setup of pcre.backtrack_limit, pcre.recursion_limit (PHP 5.2+)
What's New in This Release: [ read full changelog ]
· The assign_block function was broken.
· A shortcut for assign_block was added.
· PHPUnit test cases were added.
· The documentation was updated and provides more examples.
· Performance was improved by reducing file system access.