Login   Register  
PHP Classes
elePHPant
Icontem

File: dinamic.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Evgeny  >  tplTemplatez  >  dinamic.php  >  Download  
File: dinamic.php
Role: Example script
Content type: text/plain
Description: example
Class: tplTemplatez
Template class used to separate PHP and HTML
Author: By
Last change:
Date: 2003-04-05 04:38
Size: 794 bytes
 

Contents

Class file image Download
<?php
require ('../tplTemplatez.php');

// array with data
$array = array( 
array(
'value' => 'value1''caption' => 'caption1'),
array(
'value' => 'value2''caption' => 'caption2'),
array(
'value' => 'value3''caption' => 'caption3'),
);


// load template
$tpl = new tplTemplatez('dinamic.tpl'); 
$tpl->tplAssign('title''Form from template'); // assignin value for title

// parsing for checkbox block
foreach ($array as $k => $v) { 
    
$tpl->tplParse($v'row_checkbox');
}

// parsing for select block
foreach ($array as $k => $v) { 
    
$tpl->tplParse($v'row_select');
}    

$tpl->tplParse(); // parsing for all, because we have some vars (} they don't belong any block    
$tpl->tplPrint(); // print the result


//echo "<pre>"; print_r($_POST); echo "</pre>";
?>