From: Odysseas T. <ody...@ya...> - 2001-07-08 10:09:07
|
But you were right that the rest of the code isn't behaving the way it was supposed to :-) I needed to add a ksort right before the end of the IncludeModules function ksort($this->modules[$_group]); Keep in mind that the the "example" layout that index.php comes with is not following the default order but it explicitly alters it. Thanks for the bug, odysseas --- Justin Farnsworth <je...@ey...> wrote: > alex black wrote: > > > > > Sometimes my mind just falls apart, and I feel > like I am in that > > > state right now. In one of your last posts, you > suggested to > > > get a large/complex bit of data and store it in > a class variable, > > > and then (implied) down the load chain, this > variable can > > > be accessed. > > > > > > HOW? > > > > > $Page->modules['group_name'][load_order]->variable_name > > > > Thus my mention of possibly using unique names in > the page declaration, so > > making references to modules would be more simple. > > > > that would also complicate the page module sorting > functions, so I'm not > > sure it's worth doing that way. it may be a lot > more simple to have a module > > communication manager which is called by a module > that needs something, like > > a really simple Request class. > ================================================= > Alex: > > Oy weh. Now I was var_dump()'ing what you have > above, viz: > > var_dump($Page->modules['top'][0]); > > as I thought that was it after looking at Page.php, > and all I > was getting were NULL's. Of course, of course, I > was > in some decendant class method, and forgot to global > $Page > within the method...... > > But, Alex, you are not going to make us use this > syntax, > are you? No, you are figuring out something with a > bit more elegance, aren't you? :) > > There is _still_ something rotten, at least it seems > so, > in your array sort in Page. This load_order thingy > has, you realize, the weakness, that you can put in > index.php three modules in a 'top' group with > load_order(s) > as: > > EXAMPLE--- > > MOD1 load_order=>69 > MOD2 load_order=>22 > MOD3 load_order=>11 > > and this _should_ map/sort to > > $Page->modules['top'][0] ===> MOD3 > $Page->modules['top'][1] ===> MOD2 > $Page->modules['top'][2] ===> MOD1 > > but it doesn't. No matter what you put in your > load order, the sequence in $Page->modules['top'] > is ALWAYS IN THE ORDER OF the appearance in > index.php. > Anyway, it appears your uasort() thingy is not > working, > and that, specifically, your sorting comparison > function: > > create_function('$a,$b', 'return $a("load_order"] > - $b["load_order"];'); > > must be always returning 0, instead of (-1,0,+1) > accordingly. > > Now I am wondering, with your sorting, IF IT WERE > WORKING, > you have it mechanized, I think, that for my EXAMPLE > above, > admittedly wrong or sloppy, it would create a sparse > array > if the load_order was a number type and not a > number_string (with > quotes). > I think you also need to guard against sparse arrays > somehow. > Well, I haven't tried to "fix" > _IncludeModules($_group) > and see if it does create a sparse array.... > > OK Alex, so in any case, you are going to figure out > some > kind of way to reference _which_ instance of > multiple > loads of the same module easily. The only thing > that > occurs to me quickly is something like adding a tag, > as in: > > array( > 'name' => > "EyeLibrary", > 'package' => "lib", > 'load_order' => 2, > 'tag' => > "TableData", > 'options' => > "option1", > ), > > and then allow reference to that particular module > as: > > $Page->modules['top']['TableData']->method_or_property; > > That is knee-jerk, but gives you something to think > about. > > _jef > > > -- > Justin Farnsworth > Eye Integrated Communications > 321 South Evans - Suite 203 > Greenville, NC 27858 | Tel: (252) 353-0722 > > _______________________________________________ > binarycloud-dev mailing list > bin...@li... > http://lists.sourceforge.net/lists/listinfo/binarycloud-dev __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/ |