PHP Classes

File: example_default.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of Costin Trifan  >  AbsTemplate  >  example_default.php  >  Download  
File: example_default.php
Role: Example script
Content type: text/plain
Description: How to use AbsTemplate. No caching.
Class: AbsTemplate
Template engine based PHP script templates
Author: By
Last change:
Date: 6 years ago
Size: 1,137 bytes


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

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

// Set some variables to use in the template files
$tpl->SetVar('TITLE', 'The default usage of AbsTemplate');

$copy = '&copy;';
$tpl->SetVar('copy', 'Copyright '.$copy.' notice here');

// Get templates
$header = $tpl->GetTemplate('header.php');
$content = $tpl->GetTemplate('content.php');
$sidebar = $tpl->GetTemplate('sidebar.php');
$footer = $tpl->GetTemplate('footer.php');

<!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>