PHP Tutorial: Menu – Sub Menu in PHP/ MySQL




Hello everyone. This is a short tutorial about menus and sub menus in PHP / MySQL. Sorry for my horrible English 🙂 I haven’t spoken English since ever.

source


22 responses to “PHP Tutorial: Menu – Sub Menu in PHP/ MySQL”

  1. Thank you,
    What if I have a different MySQL table for Sub-menus? How to select parent_id from the Submenus Table? The reason is because I want to display the submenus on the main nav-bar but not in the sidebar.

    Thanks

  2. Hello. Thanks for commenting. You can achieve the desired results by adding another field to the table holding your menus / pages and name it lang. Then, by using php GET and sessions you will be able to search in the table for menus only in one language or another. I know it sound confusing 🙂 but trust me. Stick with sessions and you will succeed. 🙂 If you need any help, don't hesitate to post me. Cheers.

  3. i want to ask you for help.i really understand your way of doing this but if i have two language to display can you help me with that i.e i want the menu to be in english and german too so what am i suppose to add.appreciate any help.

  4. Thanks for commenting. In theory you are right since when the code writes the html file, it would load much faster as an include file. In practice, i don't know. You could try and post me the actual results 🙂 I could learn something from that. That's for sure :). Peace.

  5. You can actually require the data with just one query and work with that.
    with larger menus you will gain alot in performance. its way better than making a request to SQL with each sublevel.

  6. Sorry. I can't get to your link :(. I see … I think that you should go for jquery on @media screen size. Instead of dropping down the sub-submenu on hover, you must hide the underneath ul tags and show on parent click ( with alittle javascript workaround). I hope you can understand my english :). Cheers.

  7. I have a basic site set up where I have used media queries @media screen and (max-width: 800px) {….} etc in the css for various screen sizes. When the screen size gets below the set width it will remove the navigation menu and replace with a dropdown list for the user to select an option. I am wanting to hardcode the whole site. I have worked through this tutorial as well for the main layout. See youtube(dot)com/watch?v=F_fhyXUH_To

  8. Thank you for your kind words. I see that you are having trouble displaying submenus in smaller devices. Unfortunately, i have yet to see such an option in small devices. You have to come up with some sort of solution for fluid grid layouts. Like paging for example. Or you can use JQuery Mobile. What are you using Bootstrap, 960grid? Show me how you want it made.

Leave a Reply