Here I'll show you an simple example how to configure, how to use the columnset.
The PHP script
<?php
/*
* Column test
* $Header: d:/cvs/classistd/sptpl/test/test18.php,v 2.2 2004/02/10 22:08:46 Administrator Exp $
*/
function foo()
{
return("text from foo");
}
function foop($text)
{
return("my parameter:".$text);
}
require_once('../sptpl.php');
require_once('../sptpl.inc');
require_once('../sptpl_db.php');
set_time_limit(0);
$t=new sptpl();
$t->LoadTemplate('test18.xml');
$t->SetVar("name","George");
$t->SetVar("MyName","Sam");
$bar['foo']='Index foo';
$t->SetVar("bar",$bar);
// $t->_DumpInternals();
// die;
$t->run("test18.txt");
?>
|
Second step, write the configuration file test18.xml
<?xml version='1.0' ?>
<template>
<constant name='const1' value = '1'/>
<constant name='const2' value = '2'/>
<field name='fld1'>
<sourcefield>fld1</sourcefield>
<stringformat>none</stringformat>
<dateformat>none</dateformat>
<value>13</value>
</field>
<report>
<beginreport>
Hi
My First Test
</beginreport>
<OpenPage>
Column test 1
</OpenPage>
<row id='pippo'>
Some text without set the column
</row>
<columnset id='test1'>
<column leftpos='5' Width='20' align='center' />
<column leftpos='26' Width='20' align='right' />
<column leftpos='47' Width='20' align='left' />
</columnset>
<row columnset='test1' column='1'>Text on the first column
</row>
<row column='2'>Text on the second column
</row>
<row column='3'>Text on the third column
</row>
<row column='1'>Align: center
</row>
<row column='2'>Align: right
</row>
<row column='3'>Align: left
</row>
<newpage/>
<row>Another page</row>
<row vpos='absolute' rowpos='5'/>
<row>Another text</row>
<closepage>
Page end - {$PageNumber}
</closepage>
<closereport>
End!That's all folk!
</closereport>
</report>
</template>
|
And this is the output from the previous
code
Column test 1
Hi
My First Test
Some text without set the column
Text on the first Text on the second Text on the third
column column column
Align: center Align: right Align: left
Page end - 1
Column test 1
Another page
Another text
End!That's all folk!
Page end - 2
|