PHP Classes

File: test_template.php

Recommend this page to a friend!
  Classes of Vincent DiBartolo   Template.inc   test_template.php   Download  
File: test_template.php
Role: Unit test script
Content type: text/plain
Description: A short test script for Template.inc
Class: Template.inc
Super generic template processing
Author: By
Last change: comments
Date: 22 years ago
Size: 1,011 bytes
 

Contents

Class file image Download
<?php

include ("Template.inc");

print
"Testing template loading from disk\n<BR>";

//this will read in the file "test.template" and replace the delimiters
//in it with the results of the db query below. You can also populate
//from as Hash, but I have little use for this and have not tested it
//thoroughly. In this case, it's intended to take a hash like $_COOKIE
//and replace delimiters of the form "#<cookie name>#" with the cookie
//value. For replacing with db queries, delimiters should always be of
//the form "#f1#" through "#fN#" where the pound sign, the "f" and the
//last pound sign are static and the number refers to the column's
//1-based index in the result set. See the Temlate class for how to
//change the delimter and how to read from an input snippet instead of a
//file. Also see the DropDown class for a real example of this class.

$template = new Template("test.template");
print
"" . $template->processQuery("SELECT id, member_name FROM members");


?>