Question

My database is like below enter image description here

Menu I'm willing to create is as below.

enter image description here

What I want to do is create a Joomla menu as shown above depending on the table rows in a table. If I add a row to the table, automatically menu item should be created.

EG: there are 3 rows in the sports table. So three menu are created as shown.

How can I do it? Given that I know how to retrive data from the database. I can get the list of sports and what I don't know is how to put then as a menu.

Was it helpful?

Solution 3

n the Joomla framework, components are executed using menu items. If you go in the menu manager of your Joomla installation a HelloWorld menu item type does not yet exist. Adding this functionality is easy in Joomla. Simply put a site/views/helloworld/tmpl/default.xml file containing:

Read more

OTHER TIPS

Ok, remember that Joomla is a content management system so for things like content and menu items, it's all done through the admin backend.

So, in the admin backend, go to Menu Manager and select the menu you want to add items to. Then create a single menu item called "Sports", and set the type to "text separator". Then create you 3 sub menu items (Sports 1, Sports 2, Sports 3), set the type to whatever you wish, and set the parent to "Sports"

Hope this helps

If you are going the dynamic way then this table might not be sufficient for your menu. You will have to add another column known as Parent which indicates id of parent term.

And you can use jQuery to automatically append data fetched from database to existing menu code on the fly or dynamically.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top