PHP Classes

File: example4.php

Recommend this page to a friend!
  Classes of Valentin   IDtpl   example4.php   Download  
File: example4.php
Role: Example script
Content type: text/plain
Description: example script (4) shows how you can use template_in_template calls
Class: IDtpl
Template engine based on PHP template scripts
Author: By
Last change: update to new version
Date: 14 years ago
Size: 1,111 bytes
 

Contents

Class file image Download
<?php
//this template example shows how you can call template files INSIDE other template file

require_once('idtpl.class.php');

//second flag as false disallows class to store data of all templates.
//it needs if you use template_in_template structure of your site
$template = new IDtpl('templates/',false); //<--- false here

//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);

//this template call other 3 templates insede himeself
$template->template('tpl_in_tpl.tpl');

//and them display all 3 templates
$template->display();

echo
$template->exectime();
?>