Re: Having trouble with a multidimensional array menu - new and improved

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Okay, I scrapped my multi-array version and have come up with what seems to be a cleaner recursive object way of doing this.

The last bit of help I need is in the expandSelectedMenu() part. I need a way to store all the parent nodes above, then traverse them and set their CSS class accordingly as per the comment in the code.

//FIXME: so the tricky part is to expand all the directories in the path to $currentMenuItem
// we should traverse the ->parent maybe?? and set all
// <ul class="navTree toggleClosed"> goes to document.getElementById($id).className = "navTree";
// and (while not required it seems, but is good form)
// <li id="users" class="directory collapsed"> goes to document.getElementById($id).className = "directory";
// using the $id = str_replace(array(' ','\\','-'),'',strtolower($value->menu));

I've tried to do some "$value->parent =& $parent;" but when I var_dump() I start seeing all these *RECURSION* sections. It seems there should be a nicer way to store the 'root node' so to speak, and not all the children and recurse like that. I just can't figure it out.

I know that this probably won't render right for you as you need the CSS and JS and all that, but I'm happy to share that with anyone that helps out to get this solved in an elegant way. Also other suggestions and improvements are welcome. I've attached a screen shot so you can see what it looks like.

Attachment: menu.php
Description: application/php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux