Thanks, Oliver.
Here's a stripped down version of the files involved. The first is a config file, which I have at /jamba/config.php...
Code: Select all
// site config
$js_strServerName = 'localhost'; // database server
I need to access these from the class file, which I've stored at /jamba/class.php
Code: Select all
class js_jambashop {
function js_jambashop() {
// global vars required in this class
global $js_strServerName;
// configure this class
$this -> js_strServerName = $js_strServerName;
}
function js_test() {
// get the global value and print it out
echo("SERVER NAME = " . $this -> js_strServerName);
die();
}
}
I call this by using the code below...
Code: Select all
require_once ('/jamba/config.php');
require_once ('/jamba/class.php');
// instantiate the class
$js_jambashop = new js_jambashop;
// test function
$js_jambashop -> js_test();
But all I get from this is...
SERVER NAME =
My php skills are by no means polished, so I may well be going about this the wrong way!
Thanks again, Oliver. Fantastic CMS!