welcome to ...

pure-PHP templating

Hi. Here is a set of simple php scripts introdusing the idea -

" php - is a great template engine itself "

Better start looking into their source and try to guess what you'll see visiting them in your browser.

home master.php control.php top.php foot.php derived.php block.php helper.php templatelib.php multipass.php
<?//below we re-define region 'region1' placed in master template "master.php" ?>
<?
if (!function_exists('region1')){function region1($ar){?>
<?
if (is_array($ar['items']) && count($ar['items'])):?>
    Here is an extended list of items<br>
    <ul>
    <?foreach($ar['items'] as $k=>$v):?>
    <li><?=$v['name']?> (<i><?=$v['desc']?></i>)</li>
    <?endforeach?>
    </ul>
<?else:?>
    hm.. no items in the list :(
<?endif?>
<?
}}?>

<?//what template do we extend?
include('master.php');?>

header: list of 4 items

templating test

Here is an extended list of items
  • item1 (item 1 desc)
  • item2 (item 2 desc)
  • item3 (item 3 desc)
  • item4 (item 4 desc)
mail us to test@test.com