views:

39

answers:

2

Hi,

Let's say that I have a vast quantity of restaurant reviews in a database -- not Joomla articles, just database tables. I want to display these restaurant reviews as part of a Joomla 1.5 web site.

I can write a component to display each review. That part is fine. But rather than listing the reviews as a list on a page, I want to use the nice cascading menu that is part of the Joomla template that the site uses. But I don't want to have to add menu items one by one for each review; I want menu items to be generated automatically from the database contents. The menu of reviews should 'plug in' the existing menu structure for the web site (i.e., I want to supply the code that generates the menu items with an existing menu item so that it generates itself under that item).

How can I create code to programatically create that menu? Component, plug-in, module, ...? Would the menu be generated at page display time, or "manually" in the admin panel (I'm ok either way). Any examples of this already?

Thanks!

A: 

I think the simplest way would be to create a custom menu module. The absolute basic one would just output the list of reviews in a <ul> and then use some css to style the list.

silvo
Please note that the menu of reviews should 'plug in' the existing menu structure for the web site (i.e., I want to supply the programatically generated menu with an existing menu item so that it generates itself under that item). Also, it seems like menu modules seem to just style manually created menu items -- I still haven't seen anything that generates menu items?
Jimmy
In that case you should modify the standard menu module mod_mainmenu. You need to add your reviews as a menu position there. The code might get quite complicated but after a quick analysis you should be able to find your way around it.
silvo
A: 

I ended up creating a component that creates the whole menu structure at once, upon admin request. It just creates rows in the jos_menu table, as if the menus were created manually. Updating the hierachy is a pain (and I haven't completed that part), but creating the structure from scratch is pretty simple and works well.

Jimmy