|
From: Justin F. <je...@ey...> - 2001-07-08 19:05:47
|
Alex:
I did a quick hack to Page to give me the ability to know
what module to talk to by giving a module a "tag", and
gaining access by using this "tag".
I am only presenting it if someone wants to keep on
writing modules and wishes to communicate between modules.
This hack is, BY NO MEANS, some sort of suggestion for
imcorporation.
The steps are:
1. Put in index.php a global array called Modules_by_tag, thus:
$Modules_by_tag = array();
// ripped from /path/to/binarycloud/user/htdocs/index.xml
$bc_page = array(
...
2. Add code in Page.php _IncludeModules($_group) thus:
...code...
foreach ($modules[$_group]['load'] as $pos=>$mod) {
import("user.mod.$mod[package].$mod[name]");
$this->modules[$_group][$pos] = new
$mod['name']($mod['options']);
#== added by jef ==
$tag = $modules[$_group]['load'][$pos]['tag'];
if (!empty($tag)) {
global $Modules_by_tag;
$Modules_by_tag[$tag] =& $this->modules[$_group][$pos];
}
#=================
4. Add 'tag' as sppropriate in index.php for a module stanza, thus:
array(
'name' => "Blank",
'package' => "lib",
'load_order' => "300",
'options' => "appears 3rd",
'tag' => "DataDictionary",
),
5. Access the tagged module properties/methods ANYWHERE thus:
global $Modules_by_tag;
$Modules_by_tag['DataDictionary']->whoami();
It works...
_jef
--
Justin Farnsworth
Eye Integrated Communications
321 South Evans - Suite 203
Greenville, NC 27858 | Tel: (252) 353-0722
|