Notice: Memcache::get() [function.Memcache-get]: Server localhost (tcp 11211) failed with: Connection refused (111) in /srv/www/webs/feverxl.de/include/fxl_template.inc.php on line 302
FXL Template - PHP Template Engine
english english
deutsch deutsch

FXL Template


News:
2008-07-07: FXL-Template 2.1 available (incl. "memcached" alpha ext.)
 

What is FXL Template?


FXL Template an easy to use template engine covering 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>
"powered by" logos for your website:
 

 
bookmark this page at:
 
Home FXL Template contact us