PHP Classes

File: example1.php

Recommend this page to a friend!
  Classes of Valentin   IDtpl   example1.php   Download  
File: example1.php
Role: Example script
Content type: text/plain
Description: example script (1)
Class: IDtpl
Template engine based on PHP template scripts
Author: By
Last change: fix
Date: 15 years ago
Size: 982 bytes
 

Contents

Class file image Download
<?php

require_once('idtpl.class.php');
$template = new IDtpl('templates/');

//Preparation some example data to display
$title= 'Page title';
$variable= 256;
$data = array(
    array(
'title'=>'Link one', 'link'=>'http://google.com/', 'text'=>'some description...'),
    array(
'title'=>'Link two', 'link'=>'http://google.com/', 'text'=>'some description...'),
    array(
'title'=>'Link three', 'link'=>'http://google.com/', 'text'=>'some description...'),
    array(
'title'=>'Link four', 'link'=>'http://google.com/', 'text'=>'some description...')
);

$template->define('title', $title);
$template->define('links', $data);
$template->define('var', $variable);

//you can parse tpl and show html directly
$template->template('header.tpl');
$template->display();
$template->template('content.tpl');
$template->display();
//or parse tpl and get html code by using get_output
$template->template('footer.tpl');
echo
$template->gethtml();

echo
$template->exectime();
?>