nyamtoko Posted July 1, 2008 Share Posted July 1, 2008 I need to be able to create menu categories and subcategories and have them editable as in a content management system. Any help?? Link to comment https://forums.phpfreaks.com/topic/112750-editable-phpmysql-navigation-menu/ Share on other sites More sharing options...
dmccabe Posted July 1, 2008 Share Posted July 1, 2008 Sure it is as simple as anything else with php/mysql Create a table called menu's ID | Name | Description | Link And then just call the info from the db. If you need sub menu's then create another table with the table_id of the main menu ID | Name | Description | Link | Table_ID Link to comment https://forums.phpfreaks.com/topic/112750-editable-phpmysql-navigation-menu/#findComment-579064 Share on other sites More sharing options...
nyamtoko Posted July 1, 2008 Author Share Posted July 1, 2008 Thanks dmccabe. May you go a little deeper please? Am not a so able php developer. Thanks. Link to comment https://forums.phpfreaks.com/topic/112750-editable-phpmysql-navigation-menu/#findComment-579072 Share on other sites More sharing options...
dmccabe Posted July 1, 2008 Share Posted July 1, 2008 Am not a so able php developer. Thanks. Me neither however at the moment let's say you output a menu for you site like this: <ul> <li>Menu Item 1</li> <li>Menu Item 2</li> <ul> <li> Sub Menu Item 1</li> <li> Sub Menu Item 1</li> </ul> <li>Menu Item 3</li> <li>Menu Item 4</li> </ul> so instead you would create 2 tables in your database called "menu" and "submenu" and would give them the structure as above. Then in the menu table enter the name of the menu item, the description of what it will link to and then the link itself. In the submenu table you do the same but in the table_id field enter the ID of the Menu Item e.g. tbl_menu ID | Name | Description | Link 1 | Menu 1 | This is the 1st menu | http://www.blah.com/1 2 | Menu 2 | This is the 2nd menu | http://www.blah.com/2 tbl_submenu ID | Name | Description | Link | Table_ID 1 | Sub Menu 1 | the is a submenu of menu 1 | http://www.blah.com/2/1 | 2 you would then be able to write the code to simply display the output the contents of the tbl_menu with the out put of tbl_submenu in between. If you really are unsure about how to use mySQL databases with PHP then you should have a read of some tutorials on the web first. Link to comment https://forums.phpfreaks.com/topic/112750-editable-phpmysql-navigation-menu/#findComment-579090 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.