Location: PHPKode > scripts > Templato > templato/testtemplate.php
<?php
include("class.template.php");

// 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");
$myTemplate->insertHeader();

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

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

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

$myTemplate->resetLoopVar;
$myTemplate->insertFooter();

echo $myTemplate->output;

?>
Return current item: Templato