Sample> Multiple Templates

<?php

// include TPLN
include('TPLN/TPLN.php');

$menu[] = array('label'=>'Menu 1','link'=>'?id=1');
$menu[] = array('label'=>'Menu 2','link'=>'?id=2');
$menu[] = array('label'=>'Menu 3','link'=>'?id=3');
$menu[] = array('label'=>'Menu 4','link'=>'?id=4');
$menu[] = array('label'=>'Menu 5','link'=>'?id=5');


$TPLN = new TPLN;
$TPLN->defineTemplate(array(
                                
'ALL' => 'multiple_templates.html',
                                
'TOP' => 'top.html',
                                
'MAIN' => 'main.html',
                                
'MENU' => 'menu.html'
                            
));

// change to TOP template
$TPLN->changeTemplate('TOP');
$TPLN->parse('text','I\'m the top ;-)');
$top_content $TPLN->output();

// change menu
$TPLN->changeTemplate('MENU');
$TPLN->loadArrayInBloc('menu',$menu);
$menu_content $TPLN->output();


// main
$TPLN->changeTemplate('MAIN');

if(isset(
$_GET['id']))
{
    
$id $_GET['id'];
    
$TPLN->parse('id',$id);
}

if(empty(
$id))
{
    
$TPLN->parseBloc('ok','You don\'t choose menu');
}

$main_content $TPLN->output();


// ALL parse
$TPLN->changeTemplate('ALL');

// color
$TPLN->parse('top_color','#CCCCCC');
$TPLN->parse('main_color','#FFFFFF');
$TPLN->parse('menu_color','#E5E5E5');
$TPLN->parse('bottom_color','#FFFFC0');

$TPLN->fastParse('top_content');
$TPLN->fastParse('menu_content');
$TPLN->fastParse('main_content');

$TPLN->includeFile('bottom_content','bottom.html'); // Include bottom


$TPLN->write();


?>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="../style.css" rel="stylesheet" type="text/css" />
</head>
<body>

<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr align="center" valign="middle" bgcolor="{top_color}">
    <td height="100" colspan="2">{top_content}</td>
</tr>
<tr>
    <td width="150" valign="top" bgcolor="{menu_color}">{menu_content}</td>
    <td width="78%" valign="top" bgcolor="{main_color}">{main_content}</td>
</tr>
<tr align="center" valign="middle" bgcolor="{bottom_color}">
    <td height="60" colspan="2">{bottom_content}</td>
</tr>
</table>

<br>
<br>
{_Logo}<font size="1"> in {_Chrono} s<br>
Queries executed: {_QueryCount}</font>
</body>
</html>