PHP Classes

File: test.php

Recommend this page to a friend!
  Classes of Nicholas Sack   TemplateThis   test.php   Download  
File: test.php
Role: Example script
Content type: text/plain
Description: example script
Class: TemplateThis
Template compiler to separate content from logic
Author: By
Last change:
Date: 20 years ago
Size: 1,029 bytes
 

Contents

Class file image Download
<?php

include_once("lib/TemplateThis.class.php");

$parser = new TemplateThis("test.tpl");

$parser->assign("title", "Test Template");
$parser->assign("url", "http://www.sourceforge.net/");
$parser->assign("text", "SourceForge Home Page");

$parser->assign("group", "admin");

$parser->assign("pick_color", array("Red", "Green", "Blue", "Purple"));
$parser->assign("pick_default", "Red");

$parser->append("title", " - TemplateThis");

$parser->prepend("title", "TemplateThis ");

$users = array(
    array(
"NAME" => "John Doe", "CITY" => "San Francisco"),
    array(
"NAME" => "Jane Doe", "CITY" => "Nashville"),
    array(
"NAME" => "Nicholas Sack", "CITY" => "St. Louis"),
    array(
"NAME" => "Tux", "CITY" => "Linux")
);

$groups = array(
    array(
"GROUP" => "Administrators"),
    array(
"GROUP" => "Moderators"),
    array(
"GROUP" => "Users"),
    array(
"GROUP" => "Unregistered")
);

$parser->assign("users", $users);
$parser->assign("groups", $groups);

$parser->output();

?>