|
From: Odysseas T. <ody...@ya...> - 2001-07-08 09:18:16
|
The sorting works as expected.
Array order and key-value association are two
different things in php.
uasort doesnot change the key association, i.e., you
should not see a 0 indexed element if you didn't
original create one with that key.
Check the *sort man pages for more info.
odysseas
>
> 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/
|