Location: PHPKode > projects > Savant > savant-template-system/Savant-1.5.1/Savant/tests/2_display.php
<?php

/**
* 
* Tests display() issues
*
* @version $Id: 2_display.php,v 1.5 2004/03/04 01:01:00 pmjones Exp $
* 
*/

error_reporting(E_ALL);

require_once 'Savant.php';

$conf = array('template_path' => 'test_templates');
$savant =& new Savant($conf);

$array = array(
	'key0' => 'val0',
	'key1' => 'val1',
	'key2' => 'val2',
);

$var1 = 'variable1';
$var2 = 'variable2';
$var3 = 'variable3';

$ref1 = 'reference1';
$ref2 = 'reference2';
$ref3 = 'reference3';

// assign vars
$savant->assign($var1, $var1);
$savant->assign($var2, $var2);
$savant->assign($var3, $var3);

// assigns $array to a variable $set
$savant->assign('set', $array);

// assigns the keys and values of array
$savant->assign($array);

// assign references
$savant->assignRef($ref1, $ref1);
$savant->assignRef($ref2, $ref2);
$savant->assignRef($ref3, $ref3);


echo "<h1>Display non-existent template</h1>";
$result = $savant->display('no_such_template.tpl.php');
echo "result: <pre>";
print_r($result);
echo "</pre>";

echo "<h1>Storage</h1>";
echo "_tokens: <pre>";
print_r($savant->getTokens());
echo "</pre>";


echo "<h1>Display existing template</h1>";
$result = $savant->display('test.tpl.php');
echo "result: <pre>";
print_r($result);
echo "</pre>";


?>
Return current item: Savant