PHP Classes

File: example_caching.php

Recommend this page to a friend!
  Classes of Costin Trifan   AbsTemplate   example_caching.php   Download  
File: example_caching.php
Role: Example script
Content type: text/plain
Description: Caching example
Class: AbsTemplate
Template engine based PHP script templates
Author: By
Last change:
Date: 15 years ago
Size: 1,100 bytes


Class file image Download
require 'class.AbsTemplate.php';

// Instantiate the Caching Template class
$tpl = new AbsTemplate('templates','cache');

// Set some vars
$tpl->SetVar('TITLE', 'Caching templates');
$tpl->SetVar('copy', 'Copyright notice here');

// Get templates
$header = $tpl->GetTemplate('header.php',2); // set cache for 2 hours
$content = $tpl->GetTemplate('content.php',3);
$sidebar = $tpl->GetTemplate('sidebar.php',4);
$footer = $tpl->GetTemplate('footer.php',5);

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title><?php echo $tpl->GetVar('TITLE');?></title>
<div id="layout">
    <div id="header"><?php echo $header; ?></div>

    <div id="body">

        <div id="content"><?php echo $content; ?></div>

        <div id="sidebar"><?php echo $sidebar; ?></div>

    <div id="footer"><?php echo $footer; ?></div>