PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Vladislav Litovka   Simple Template class   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example
Class: Simple Template class
Template engine based on assigning PHP variables
Author: By
Last change: updated
Date: 15 years ago
Size: 713 bytes
 

Contents

Class file image Download
<?php
require_once('class.template.php');
$template = new Template('templates/');

//Preparation some data to display
$data = array(
            array(
'title' => 'First title', 'link' => 'http://google.com', 'text' => 'And more...'),
            array(
'title' => 'Second title', 'link' => 'http://google.com', 'text' => 'And more...'),
            array(
'title' => 'Third title', 'link' => 'http://google.com', 'text' => 'And more...'),
            array(
'title' => 'Fourth title', 'link' => 'http://google.com', 'text' => 'And more...')
            );
$somevar = 11;
$title = 'Page title';

$template->assign('links', $data);
$template->assign('somevar', $somevar);
$template->assign('title', $title);
$template->display('show.tpl');
?>