|
From: alex b. <en...@tu...> - 2001-07-16 02:23:11
|
> Are any of you building sites with BC and using inter-module
> "communication", that is, fetching variables or calling
> methods in another module with the construct:
>
> $return = $Page->modules[group][idx]->foo();
>
> or
> $some_var = $Page->modules[group][idx]->bar;
>
> ?????????
>
> IF YOU ARE DOING THIS, DOES IT WORK FOR YOU?
I am not doing that. And of course it would not work very well, because it
is 100% relying on the load order, which is of course, page specific.
Why are you calling methods in one module from another module?
> Now, if you are concerned or interested, you can read
> farther. I have been having all kinds of strangeness
> trying to make this "intermodule" communications work,
> which should just be nothing more, except through
> a couple more dereferences, than calling a method
> in a class or fetching a var in a class in the
> same namespace.
I think this all depends on whether you need to maintain the state of the
module you need to talk to - i.e. do you need to differentiate between
individual instances of the same module, or can it just be "any instance"
----
If it's the former, I think in future we'll deal with that (a manager) - but
you can do it now with module ids (your tag thing, I implemented it)...
Or, really for 90% of things, global variables.
> 1. top has two modules, EyeLibrary
> and DataDictionary
> 2. main has two modules, Lister and
> TestMain
> 3. left has one module, TestNavLeft
> 4. bottom has two modules, Warning and
> Blank
>
> SO, if in the TestMain module I put this
> little bit of debugging code
>
> global $Page;
> if(1) {
> echo "<pre>";
> $group = "top";
> $idx = 0;
> $item =& $Page->modules[$group][$idx];
> if (empty($item)) { printf("EMPTY reference in [%s][%d]",$group,$idx); }
> print_r($item);
> echo "</pre>";
>
> What is rendered is fine, namely
> eyelibrary Object
> (
> [options] => appears 1
> )
>
> which is expected, since EyeLibrary is the first in the group.
>
> if I change group to main and idx remains at 0,
> what I get is expected, namely the Lister
>
> lister Object
> (
> [tableOptions] => Array
> snip
>
> BUT IF I LOOK FOR group = "bottom", idx = 0,
> I get:
> EMPTY reference in [bottom][0]
Have you looked at a printf of the $Page object to see if the thing you are
making reference to exists?
> This is same for the group 'left". In other
> words, I cannot "see" anything in groups 'left'
> or 'bottom".
>
> Any ideas? I have some VERY WILD ones, like Zend
> sees, somehow, the method of instantiation that
> BC uses as a recursion, and Zend is throwing something
> away after three levels.
I really, really, _really_ doubt it has _anything_ to do with the zend
engine.
:)
_a
|