Ran into a problem with trying to use the class within a function and while I have found a work around.. I was wondering If there is something I am missing..
I am trying to use this class within a function and ran into some problems... The code below is a example.. I have put the include within the function and outside the function, but what is happening is annoying...
<?
$image_path = "test.aboutdoinggood.com/images/";
function createpage() {
$tpl = new template;
$tpl->load_file('tplfile','templates/1/template.html');
$image_path = "gary.aboutdoinggood.com/images/";
$tpl->register('tplfile','image_path');
$tpl->parse('tplfile');
$output = $tpl->return_file('tplfile');
$fp = fopen("/ADG/gary/test.html","w");
fwrite($fp,$output);
fclose($fp);
}
?>
You notice I have image_path defined both inside and outside the function.. The issue is this.. the one OUTSIDE the function is overriding the one inside.. Its like the class doesnt stick to the normal standards of global use and such.. I can sovle this by pre-defining each variable as global from the start.. But in my true code I have over 35 variables.. so its a pain.