Hi,
Perhaps you can help before I take a hammer to my pc! I am trying to modify a template class to accept a path input for includes files I almost have it working, here is the problem...
If I declare the path explicitly in the class like this:
var inc_path = "/templates/";
It works, but if I declare the inc_path variable as:
var inc_path;
Then set it externally like this...
mytemplateobj->inc_path = "/templates/";
It does not work! I have set up a few temporary functions to make sure that the variable is being "seen" within the class and it is!!! But the function that I am trying to parse the variable to refuses [Note that word refuses!!!] to "see" the variable
I am going nuts and have spent over 3 hours trying to sort out the problem. I can't understand why it works if I explicitly declare the variable but not if I externally declare it! Inconceivable!!!
I am not going to include all the code... just the bits that will give an idea....
class blah
{
var $inc_path;
/This function works when I set the variable externally and does indeed echo the variable..../
function dwanetest()
{
echo "<hr>THis is my TEst -- - " . $this->inc_path . "$blah <hr>";
}
// Using a function to set the path does not work either...
function set_path($the_path)
{
$this->inc_path = $the_path;
}
/This function does not work unless I set the variable within the class file above
as follows:
var $inc_file = "/templates/" ;
*/
function r_getfile($file) {
echo "<hr>debug test....." . $this->inc_path . "<hr>";
//die;
$text=$this->getfile($file);
while (preg_match($this->file_delim,$text,$res)) {
echo $this->inc_path;
$text2=$this->getfile($this->inc_path . $res[1]);
$text=preg_replace("'".preg_quote($res[0])."'",$text2,$text);
}
return $text;
}
}
Not even the echo of the variable works...here is my code calling the class...
$templateObj = New XTemplate ($maintemplatedir . "/main.htm");
$templateObj->inc_path = "/Templates/";
I have even tried to set the path with a function but get the same result..
//$templateObj->set_path();
$templateObj->dwanetest();
Your help may save the life of a computer.
Thanks.
Dwane.