Hey guys
how do i customise this class so that the Creatpage() function ( page send to the browser) is processed as a php page instead of a html page . my html template has php include codes in the tables so it has to be processed as .php ?????
tried to save the template.php as template.inc and template.php.inc????? but doesnt work
pure html code runs well but once i include php code it it then the template.inc doent open ..pls help it has to work
thanks
<?php
class HtmlTemplate{
var $template;
var $html;
var $parameters= array();
function HtmlTemplate ($template) { //sets which template to be used
$this->template = $template;
$this->html = implode("",(file($this->template))); //read the template into an array and then creat
}
function SetParameter ($variable,$value){ //sets tha particular values
$this->parameters[$variable] = $value;
}
function CreatePage (){ //does the bulk of the work
foreach ($this->parameters as $key => $value){ //loop thro all the parameters and set the variables to values.
$template_name='{'.$key.'}';
$this->html =str_replace($template_name,$value,$this->html);
}
echo $this->html;
}
}
?>
how do i customise this class so that the Creatpage() function ( page send to the browser) is processed as a php page instead of a html page . my html template has php include codes in the tables so it has to be processed as .php ?????
tried to save the template.php as template.inc and template.php.inc????? but doesnt work
pure html code runs well but once i include php code it it then the template.inc doent open ..pls help it has to work
thanks
<?php
class HtmlTemplate{
var $template;
var $html;
var $parameters= array();
function HtmlTemplate ($template) { //sets which template to be used
$this->template = $template;
$this->html = implode("",(file($this->template))); //read the template into an array and then creat
}
function SetParameter ($variable,$value){ //sets tha particular values
$this->parameters[$variable] = $value;
}
function CreatePage (){ //does the bulk of the work
foreach ($this->parameters as $key => $value){ //loop thro all the parameters and set the variables to values.
$template_name='{'.$key.'}';
$this->html =str_replace($template_name,$value,$this->html);
}
echo $this->html;
}
}
?>