Just posting this as a courtesy as I had a difficult time finding any info on this subject in the forums.
-Tested on 2.2.x ONLY-
(but I don't think there would be an issue with earlier versions.)
While it's easy enough to hardcode a menu into your theme, many would prefer a more dynamic menu.
I poked around with multimenu and some other (Javascript/flash) solutions, but was not getting exactly what I was looking for. Using the code from the myxoops DW extension, I have cobbled the following code together.
It will disply sublinks exactly as the XOOPS main menu block does for each module in a SEO friendly manner.
You will need to edit the code in order to use it, but basically, once you set the main links up, the code will dynamically call any sublinks for the module you are in and display them beneath the main menu... (hence semi-dynamic).
The original myxoops code(thanks POD) had some formatting that was not working well for me (Table structure was whaking out my css) as well as some user/admin menu options which I was not going to use (I use the user menu as a block in conjunction with this.)
I'll post the code, then explain a bit more.
The first portion should be inserted in the header, right before the body tag (you could also include it in header.php if you wanted.
OK, the 4th line:
is the first complete entry.
Using the format above add/remove any main links you would like to display making sure to use the actual directory names of your install. (the | code which follows is a seperator, remove if you wish).
Here, we are setting up a string which we will call for diisplay later in our theme. I broke it up this way to allow a single line of code to be inserted for display making it easier to fit into your theme.
Using the format above add/remove any main links you would like to display.
Once you have specified your menu items as described above insert the following code into your theme where you would like the menu to appear.
<{php}>
echo $mainmenu_str ;
echo $submenu_str ;
<{/php}>
you can string the above together like this to make it easier to edit your theme in a wysiwyg editor:
Quote:
<{php}>echo $mainmenu_str ; echo $submenu_str ;<{/php}>
Now all you have to do is style it however you want.
FYI to apply a style, add a class tag to the a href tag to the string in the header... EG:
To apply a style called sublinks (which you have defined as a class in your theme's CSS) to the sublinks you would add class='yourclasshere' to the code in the head section. In the example below, the ****> is emphasising where the code change is, do not include the stars and brackets.
foreach( $sublinks as $sublink ) {$submenu_str .="class='sublinks'<**** href='$xoops_url/modules/$dirname/{$sublink['url']}'>{$sublink['name']} | ";
I prefer to center the code which will present any sublinks that the module has beneath the main menu in the center. You can kick it around a bit.
Good luck and have fun.