Jump to content


Photo

Menus


  • Please log in to reply
1 reply to this topic

#1 shan_cool

shan_cool
  • Members
  • PipPipPip
  • Advanced Member
  • 53 posts
  • LocationChennai,India

Posted 25 April 2006 - 08:23 AM

Hi all,

I want to implement Sub menus in PHP,How can i do it?

Thanks,
Shan_cool

#2 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 25 April 2006 - 09:13 AM

personally I have a table 'sections'. Within that table I have all the details for my menus and two fields - root_id and parent_id

so top level menu item has root_id = 0 and parent_id = 0

I select the entire table and pace it in a array

I then use a recursive function that uses array_keys to grab all the items from each top level element and as it traverses the array, will select all the items from the immediate parent element - quite elegant IMO
follow me on twitter @PHPsycho




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users