Login   Register  
PHP Classes
elePHPant
Icontem

File: test2.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Andrioli Darvin  >  SpoolTemplate  >  test2.php  >  Download  
File: test2.php
Role: Example script
Content type: text/plain
Description: Second example
Class: SpoolTemplate
Database report generation based on templates
Author: By
Last change:
Date: 11 years ago
Size: 929 bytes
 

Contents

Class file image Download
<?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");
?>