Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Gregory  >  Cached TemplatEze  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script by David Agar
Class: Cached TemplatEze
Template engine based on replacement with caching
Author: By
Last change:
Date: 2004-10-03 17:24
Size: 922 bytes
 

Contents

Class file image Download
<?
define 
('PATH'dirname(__FILE__));
define ('GZIP'FALSE);

require_once 
"tpl.php";        // Template driver
require_once "dcc.php";        // Content Caching routines

$tpl = new dcc("example""other");

if (
$tpl->cache_start()) {

    
$vars = array(
        
'var1' => "Variable 1 Replaced from array OK",
        
'var2' => "Variable 2 Replaced from array OK",
    );

    
$tpl->assign($vars);
    
$tpl->assign('var3'"Variable 3 Replaced OK");

    
$table_rows = array();
        
$table_rows[] = array( 
        
'id' => '1',
        
'first_name' => 'John',
        
'surname' => 'Smith'
        
);

        
$table_rows[] = array(
        
'id' => '2',
        
'first_name' => 'Bill',
        
'surname' => 'Jones'
        
);

        
$table_rows[] = array(
        
'id' => '3',
        
'first_name' => 'Tom',
        
'surname' => 'Robins'
        
);
    
$tpl->assign("table_rows");

    
$tpl->assign("template_head");
    
$tpl->assign("template_side");
    
$tpl->cache_stop();
}
$tpl->done();
?>