File: testtemplate.php

Recommend this page to a friend!
  Classes of Niels Scheffers  >  Templato  >  testtemplate.php  >  Download  
File: testtemplate.php
Role: Unit test script
Content type: text/plain
Description: Testing script showing the use of loops
Class: Templato
Template class with looping capabilities
Author: By
Last change:
Date: 18 years ago
Size: 874 bytes



Class file image Download

// TESTING SCRIPT FOR class.template.php
$testarray = array("This", "Is", "A", "Test");
$testarray2 = array("This", "Is", "Another", "Test");

$myTemplate = new Template("example.html");

$myTemplate->getLoop("LOOP NUMBER 1");

reset($testarray); // Set cursor to start
foreach ($testarray as $row) {
$myTemplate->setLoopVar("MESSAGE 1", $row);

$myTemplate->getLoop("LOOP NUMBER 2");

reset($testarray2); // Set cursor to start
foreach ($testarray2 as $row) {
$myTemplate->setLoopVar("MESSAGE 2", $row);




For more information send a message to info at phpclasses dot org.