Return to Snippet

Revision: 12918
at April 1, 2009 13:48 by Agundur


Initial Code
<?php
require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'class_template.php');
require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'class_section.php');

/**
* class section "Intro" *
**/
$sec        =  new section();
$sec->dir    =  dirname(__FILE__).DIRECTORY_SEPARATOR;
$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);

    if(is_int($i/2)){
        $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');
?>

Initial URL
http://template.ecoware.de

Initial Description
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.

Initial Title
SKOR PHP Template

Initial Tags
class, php, template, web, Development

Initial Language
PHP