[eluser]jedd[/eluser]
[quote author="MEM" date="1256760365"]
When we click on "Fitofármacos", I can display the correspondent children! This is great! And I'm really happy!
When we click on Fitofármacos children - "Herbicidas", I was expecting to have returned Herbicidas childs, without losing the Fitofármacos menu item.
The reason I'm loosing him, I suppose, it's because the URI is not properly generated by the function responsible to parse a menu.
[/quote]
As long as these are organic herbicides, I'll be happy to help (I'm a permaculturist - so naturally wary
The reason you're losing the parent, is because you're only displaying the new entity + new entity's children.
Quote:Can I have your help in order to understand how can I recursively build the URI segments?
By recursively build the URI segments, do you mean the model / database side that pulls out the information, or actually generating a URL that provides the full parentage? If you mean the URL thing, I'd suggest you don't go down that path - it'll get ugly. Any single ID you get on the URL can be used to identify WHERE in the hierarchy you are - and you can then have model calls that look up parentage, as well as children.
On my site database that I sent you the URL for, I show all the parentage (each item has a single parent, so I just recursively head upwards until I find a parent_id of 0) and I show only the immediate children.
The parentage information is used to give the user some context for what they're looking at. If you don't give them that information, then it will be like you have shown above - the user sees Fitofármacos, but then loses it when they go into Herbicidas - and they don't have anything on the screen to indicate how to get back up to Fitofármacos, or where Herbicidas fits into the overall structure.
How about something like this:
visual information to the user (view stuff) has a prefix like this:
Top | Fitofármacos | Herbicidas - children : herb1, herb2, herb3 -- where Herbicidas (in this case) is bold/larger/not-a-URL-link but everything else is a link
database functions (model stuff):
find_parents ( $thing ) - returns an array of parentage for the $thing
find_children ( $thing ) - returns an array of children of $thing
Those two arrays would be enough to create the view I described. Would that approach kind of get you where you want to go?