greetings all. i've got a complicated setup, and i'll try to make this as clear as possible. i've got a main class (lets call it MAIN in this example) that is performing various operations. at one point, it 'dynamically' loads other classes in order to perform other specific actions. those classes a loaded like this.
foreach ($services['config'] as $module => $config)
{
$module_path = '/path/to/lib/' . $module . '.php';
if (!is_file($module_path))
{
die("Cant load needed module $module (file $module_path does not exist");
}
else
{
if(!class_exists($module))
{
include_once $module_path;
$$module = new $module();
$this->data[$module] = $$module->ini();
}
}
}
as you can see, every class as a ini() function that is gathering data, and then returns it in an array, that is saved into the big fat array 'data' (on a per module basis).
now, it is very possible that module Y needs to access some of modules X data in order to perform operations.
im stuck now. see this example :
in class Y, in need to access data gathered earlier from class X, so i build a simple method in the MAIN class, like this :
function moduleX($what, $login) {
return $this->data['moduleX'][$login][$what];
}
then, in class Y ...
$uid = MAIN::moduleX('uid', $this->service['login']);
result ? empty : (
any pointers anyone ?
thanks ! : )