<?php
/*
* test 2: print data form global array
*/
function foo()
{
return("text from foo");
}
function foop($text)
{
return("my parameter:".$text);
}
require_once('sptpl.inc');
$t=new sptpl();
$t->LoadTemplate('test2.xml');
$LoopArray=array();
for($i=1;$i<200;$i++)
$LoopArray[]=array('field1' => 'row '.$i.', field 1',
'field2' => 'row '.$i.', field 2');
$MyArray=array( array('field1' => 'row 1, field 1',
'field2' => 'row 1, field 2'),
array('field1' => 'row 2, field 1',
'field2' => 'row 2, field 2'),
array('field1' => 'row 3, field 1',
'field2' => 'row 3, field 2'),
);
$GLOBALS['MyArray']=$MyArray;
$GLOBALS['LoopArray']=$LoopArray;
$t->SetVar("name","George");
$t->SetVar("MyName","Sam");
// $t->_DumpInternals();
$t->run("test2.txt");
?>
|