/ Published in: PHP
Skor PHP Template class can assign individual variable values or arrays with several variable values. A separate sub-class extends the base class to support delimited template section replacements.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php /** * class section "Intro" * **/ $sec = new section(); $sec->html = 'section.html'; $sec->read(); /** * class section "Hello world" * **/ $sec->assign_section('Head'); $sec->assign('HALLO','Hi World'); $sec->assign_section('Example'); /** * class section "Alternating table rows" * **/ $tbody = ''; for($i = 0; $i <= 5; $i++){ $sec->assign('COUNTER', $i); $tbody .= $sec->fetch('RowGreen'); }else{ $tbody .= $sec->fetch('RowRed'); } } $sec->assign('TBODY',$tbody); $sec->assign_section('Table'); /** * class section "Nested sections with two children" * **/ $sec->assign('PLACEHOLDER','placeholder'); $sec->assign('MOTHER',$sec->fetch('ChildOne') . $sec->fetch('ChildTwo')); $sec->assign_section('Mother'); /** * class section footer" * **/ $sec->assign_section('End'); ?>
URL: http://template.ecoware.de