accessing variable from inside a class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

How do i access a variable from inside a class? ex. I want to use
$template_dir inside Template.


$template_dir = 'templates/';

class templateParser {
	var $output;
	
	function templateParser($templateFile='default_template.htm')
	{
		(file_exists($template_dir.$templateFile)) ? 
			$this->output=file_get_contents($template_dir.$templateFile) 
			:
			die('Error:Template file '.$template_dir.$templateFile.' not found');
	}
	
}

I run Fedora 10, apache 2.2.11 and php 5.2.9.
I get an error saying that $template_dir is undefined.

Regards
Lars Nielsen


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux