PHP Classes

File: dinamic.php

Recommend this page to a friend!
  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: 20 years ago
Size: 794 bytes


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

// array with data
$array = array(
'value' => 'value1', 'caption' => 'caption1'),
'value' => 'value2', 'caption' => 'caption2'),
'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>";