I had the same problem so I came up with this php snippet. Just put it right in before your HTML tag:
le="color: #000000"><?php <{php}> //********************* custom main menu *********************// // There must be an easier way to achieve this but this is what I // // came up with. Smarty programming seems to be acting wierd in a // // template so i have to do it the old fashioned way: straight PHP // // Broke up the menu building into simple functions to keep HTML // // tags out of the menu code. ONLY EDIT THE $htmlcode="..."; LINES // // It's dirty but it works. // // -xoopstuner // //*****************************************************************// //mini template for custom main menu function xtnrMenu($Menu,$activeModuleName,$activeModuleLink,$activeModuleSublinks){ $htmlcode=" | <a href=".XOOPS_URL." >Home</a> |$Menu "; return $htmlcode; } //mini template for menu link and sublinks placement function xtnrMenuLink($linktitle,$link,$sublinks){ $htmlcode=" <a href=$link >$linktitle</a> | "; return $htmlcode; } //mini template for menu link when there are no sublinks, active takes precidence function xtnrMenuLinkEmpty($linktitle,$link){ $htmlcode=" <a href=$link >$linktitle</a> | "; return $htmlcode; } //mini template for menu link and sublinks placement for currently selected module function xtnrMenuLinkActive($linktitle,$link,$sublinks){ $htmlcode=" <strong><a href=$link >$linktitle</a></strong> | "; return $htmlcode; } //mini template for sublinks function xtnrMenuSublink($linktitle,$link){ $htmlcode=" ---<a href=$link >$linktitle</a><br> "; return $htmlcode; } //mini template for sublinks of currently active module function xtnrMenuSublinkActive($linktitle,$link){ $htmlcode=" ---<a href=$link >$linktitle</a>-active<br> "; return $htmlcode; } //modified main menu block code global $xoopsUser,$xoopsModule,$customMainMenu,$activeModuleName,$activeModuleLink,$activeModuleSublinks,$temp; $block = array(); $block['lang_home'] = _MB_SYSTEM_HOME; $block['lang_close'] = _CLOSE; $module_handler =& xoops_gethandler('module'); $criteria = new CriteriaCompo(new Criteria('hasmain', 1)); $criteria->add(new Criteria('isactive', 1)); $criteria->add(new Criteria('weight', 0, '>')); $modules =& $module_handler->getObjects($criteria, true); $moduleperm_handler =& xoops_gethandler('groupperm'); $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; $read_allowed =& $moduleperm_handler->getItemIds('module_read', $groups); foreach (array_keys($modules) as $i) { if (in_array($i, $read_allowed)) { $modulesname = $modules[$i]->getVar('name'); $moduledirectory = $modules[$i]->getVar('dirname'); $sublinks =& $modules[$i]->subLink(); $sublinkshtmlout = ''; if (empty($xoopsModule)) { //system module; fill in defaults $mid=-1; $activeModuleName="Home"; $activeModuleLink=XOOPS_URL; $activeModuleSublinks=''; } else { $mid=$xoopsModule->getVar('mid'); } //build sublinks for module if ((count($sublinks) > 0)) { if ($i == $mid) { foreach($sublinks as $sublink){ //current active module $sublinkshtmlout =$sublinkshtmlout.xtnrMenuSublinkActive ($sublink['name'],XOOPS_URL.'/modules/'.$modules[$i]->getVar('dirname').'/'.$sublink['url'] ); $activeModuleSublinks =$activeModuleSublinks.xtnrMenuSublinkActive ($sublink['name'],XOOPS_URL.'/modules/'.$modules[$i]->getVar('dirname').'/'.$sublink['url'] ); } } else { foreach($sublinks as $sublink){ //not current active module $sublinkshtmlout =$sublinkshtmlout.xtnrMenuSublink ($sublink['name'],XOOPS_URL.'/modules/'.$modules[$i]->getVar('dirname').'/'.$sublink['url'] ); } } } else { $block['modules'][$i]['sublinks'] = array(); } // Build Main Menu Link From mini template if ($i == $mid) { //current active module $activeModuleName = $modulesname; $customMainMenu = $customMainMenu.xtnrMenuLinkActive($modulesname, XOOPS_URL.'/modules/'.$moduledirectory, $sublinkshtmlout); $activeModuleLink = $activeModuleLink.xtnrMenuLinkActive($modulesname, XOOPS_URL.'/modules/'.$moduledirectory, $sublinkshtmlout); } else { //not current active module if ($sublinkshtmlout==''){ $customMainMenu =$customMainMenu.xtnrMenuLinkEmpty($modulesname, XOOPS_URL.'/modules/'.$moduledirectory); } else { $customMainMenu =$customMainMenu.xtnrMenuLink($modulesname, XOOPS_URL.'/modules/'.$moduledirectory, $sublinkshtmlout); } } } } $customMainMenu = xtnrMenu($customMainMenu,$activeModuleName,$activeModuleLink,$activeModuleSublinks); //no output if no modules if (count(array_keys($modules))==0) {$customMainMenu ='';} <{/php}>
In the template where I want my custom main menu I put
le="color: #000000"><?php <{php}>echo ($customMainMenu);<{/php}>
I have used this in a few of my templates, including one which makes a popup menu based on the GOSU menu script in the admin theme of XOOPS 2.2
You shouldn't have to modify anything but the 'mini templates' at the beginning of the script to fit your theme.
You can download a theme with it at
http://www.xoopstuner.com xtnrBusiness is what this is pasted from and xtnrPortable has the popup menu script in it, twice.