1
wammes
1 module, multiple mainmenu items?
  • 2004/12/28 11:47

  • wammes

  • Not too shy to talk

  • Posts: 101

  • Since: 2002/1/3 1


I have already managed to add some submenu items in my custom module, using
$sql = $xoopsDB->query("SELECT groepid, naam FROM ".$xoopsDB->prefix("sgminhoud_groep")." WHERE inmainmenu = 1");
$subcount = 1 ;
while ( list( 
$groepid, $naam ) = $xoopsDB->fetchRow( $sql ) )
        {
        
$modversion['sub'][$subcount]['name'] = $naam;
        
$modversion['sub'][$subcount]['url'] = "groep.php?groep=".$groepid."";
        
$subcount++ ;
        }
in xoops_version.php

It generates submenus like a charm. But I dont want those items to be a subitem. I need them to be added to the mainmenu as 'main'-items (if you understand me... )

Could someone push me in the right direction? Or isn't this possible? In other words: can a module have more then one mainmenu entries?

2
solo71
Re: 1 module, multiple mainmenu items?
  • 2004/12/28 11:56

  • solo71

  • Module Developer

  • Posts: 941

  • Since: 2003/1/29


I don't think it's possible. That's probably the reason why such modules like multiMenu do exist...


3
wammes
Re: 1 module, multiple mainmenu items?
  • 2004/12/28 12:13

  • wammes

  • Not too shy to talk

  • Posts: 101

  • Since: 2002/1/3 1




Another advertisement for the multimenu

But multimenu cannot do this, right? I mean a menu with dynamic (sub)menuitems like mainmenu? I still have to add the menuitems by hand...

That is not really what I want. I think I want to cross a xoops-boundary here....

4
carnuke
Re: 1 module, multiple mainmenu items?
  • 2004/12/28 13:16

  • carnuke

  • Home away from home

  • Posts: 1955

  • Since: 2003/11/5


Warmes, does this FAQ help?

Another option ... in admin> modules admin make your module link invisible in main menu. Now use multimenu to display all the links you want for that module. This gives you full control.

5
solo71
Re: 1 module, multiple mainmenu items?
  • 2004/12/28 13:19

  • solo71

  • Module Developer

  • Posts: 941

  • Since: 2003/1/29


Quote:

wammes wrote:

But multimenu cannot do this, right? I mean a menu with dynamic (sub)menuitems like mainmenu? I still have to add the menuitems by hand...

MultiMenu does exactly what the main menu does... except that you have to create it manually, indeedly.


6
wammes
Re: 1 module, multiple mainmenu items?
  • 2004/12/28 18:12

  • wammes

  • Not too shy to talk

  • Posts: 101

  • Since: 2002/1/3 1


Gentlemen,

thank you all for your input.

Carnuke: The FAQ answer is very clear to me, but it is still not really what I want. The menu items must be dynamic, like the submenu's in the edito module. For each article added by users a new link in the mainmenu. The FAQ helped me moving my focus from xoops_version.php to the main menu template. I decided to add some dirty code in the mainmenu:
....<!-- end module menu loop -->
<{
php}>
global 
$xoopsDB;
echo(
"<table cellspacing="0"><tr><td id="mainmenu">");

$sql = $xoopsDB->query("SELECT groepid, naam FROM ".$xoopsDB->prefix("sgminhoud_groep")." WHERE inmainmenu = 1");

while (list(
$groepid,$naam)=$xoopsDB->fetchRow($sql))
        {
echo(
"<a class="menuMain" href="/modules/sgminhoud/groep.php?groep=".$groepid."">".$naam."</a>");
        }

echo(
"</td></tr></table>");
<{/
php}>
    </
td>....

By putting the php code in the main menu I don't have to add the links manually. When a new 'groep' is made, the mainmenu will be updated automatically. The only drawback is all the links are always on the bottom of the main menu list. But I can live with that.

Once again: thanks for the feedback!

7
carnuke
Re: 1 module, multiple mainmenu items?
  • 2004/12/28 18:28

  • carnuke

  • Home away from home

  • Posts: 1955

  • Since: 2003/11/5


wammes, My appologies, I have not used the edito module, so I was not aware of this possibility.

Looks to me like you are finding your own solutions, which is great! Please share here what you create and develop.

Good luck