PHP Classes
Icontem

File: example.php


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Dmitry Levashov  >  MyTemplate  >  example.php  
File: example.php
Role: Example script
Content type: text/plain
Description: Example
Class: MyTemplate
Powerfull template engine
 

Contents

Class file image Download
<?php
$start 
utime();

include 
'./MyTemplate.class.php';

$T = new MyTemplate();    

/* set template which contains nested template, which will be shown at the top and bottom of the page */
$T->setFile('example''templ.html');

$T->assignVars('page_title''MyTemplate test page');

$menu = array(
        array(
'id'=>'home''point'=>'Home page'),
        array(
'id'=>'about''point'=>'About us'),
        array(
'id'=>'download''point'=>'Download page'),
        array(
'id'=>'contacts''point'=>'Contacts')
        );

/* 
 * to process dinamic block we need only assign his variables. Not need to parse it
 */
for($i=0$isizeof($menu); $i++) {
    
$T->assignBlockVars('MENU.POINT'$menu[$i],1);
}

$T->assignVars('today'date('m/d/Y '));
$T->assignVars('today'date('l'), true);

$T->assignBlockVars('TABLE.THEAD', array('table_header'=>'Here is test table header'));

for (
$i=1$i<=200$i++) {
    
/*
     * when we have to begin new row?
     */
    
$level = ($i==|| $i%== 1) ? 2;
    
$T->assignBlockVars('TABLE.ROW.CELL', array('cell_text'=>'Cell number '.$i), $level);
}

// that is all :)
$T->fprint('example');

echo 
"<br>Page create in: ".(utime()-$start)." sec.<br>";

function 
utime ()
{
    
$time explode" "microtime());
    
$usec = (double)$time[0];
    
$sec = (double)$time[1];
    return 
$sec $usec;
}

?>

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products