Applying empty a href links to menu items with sub-menus.

images php coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
php-forum Fan User
php-forum Fan User
Posts: 622
Joined: Fri Aug 05, 2011 9:53 am

Sat Jul 02, 2016 12:07 am

I would have thought that parentid has nothing to do with this menu item having no child menu items. All it means is that this is a root menu item.
Would it be better to read in all the menu items, then go through them all and flag each menu item that is referred to (via a parentid). Then any menu item that has a flag should not have a link.
One thing about the way your doing it is that it looks as though you assume that the menu items are in the correct order from the database, you might want to think about creating a sort of menu tree structure from this data to allow you to build up the menus prior to outputing them.

Post Reply