1
Mike1234
help hiding submenu until parent is clicked
  • 2004/10/21 14:11

  • Mike1234

  • Just popping in

  • Posts: 16

  • Since: 2004/8/16


Well, this is my first semi-advanced question, so I think I am learning xoops. :)

I am hand coding a menu w/submenus so I can pick which items to show (instead of showing all modules like the Main Menu). This works fine:

<table cellspacing="0">
  <
tr>
    <
td id="mainmenu">
      <
class="menuTop" href="<{$xoops_url}>/">Home</a>
    <
class="menuMain" href="<{$xoops_url}>/modules/tinycontent/">Company</a>
        <
class="menuSub" href="<{$xoops_url}>/modules/tinycontent/index.php?id=2">About Us</a>
<
class="menuSub" href="<{$xoops_url}>/modules/tinycontent/index.php?id=3">Clients</a>
     <
class="menuMain" href="<{$xoops_url}>/modules/tinycontent0/">Software</a>
   </
td>
  </
tr>
</
table>


But when displayed in a Block, the About Us and Clients (submenus) show even when Software (or Home) is clicked. How can I hide About Us and Clients so that they don't show up unless Company is clicked?

thx

2
Mike1234
Re: help hiding submenu until parent is clicked
  • 2004/10/21 17:59

  • Mike1234

  • Just popping in

  • Posts: 16

  • Since: 2004/8/16


Maybe it will help if I rephrase my question: Where does the Main Menu Block get the instructions to hide subitems until the module is pressed? I can't find anything in the template...just a couple of for loops.

Example News, Web Links both have subitems that don't show without the parent being first picked.

Thanks

3
ackbarr
Re: help hiding submenu until parent is clicked

the php code that fills the template determines which module is active, and only fills the sub-menu elements for that module.
To look at the code, see:
/modules/system/blocks/system_blocks.php in the function b_system_main_show()

4
Mike1234
Re: help hiding submenu until parent is clicked
  • 2004/10/21 19:56

  • Mike1234

  • Just popping in

  • Posts: 16

  • Since: 2004/8/16


Ok, got it, but where does it say "don't *display* SubMenu elements in the menu until the menu element is chosen. I.E you hit home and all the SubMenu items are hidden...

thx
mike

5
ackbarr
Re: help hiding submenu until parent is clicked

$sublinks =& $modules[$i]->subLink();
  [
color=0080FF][b]if ((count($sublinks) > 0) && (!empty($xoopsModule)) && ($i == $xoopsModule->getVar('mid'))) {[/b][/color]
    foreach(
$sublinks as $sublink){
      
$block['modules'][$i]['sublinks'][] = 
        array(
'name' => $sublink['name'], 
        
'url' => 
        
XOOPS_URL.'/modules/'$modules[$i]->getVar('dirname') . '/'$sublink['url']);
    }
  [
color=0080FF][b]} else {[/b][/color]
   
$block['modules'][$i]['sublinks'] = array();
  [
color=0080FF][b]}[/b][/color]

The highlighted code above is responsible for determining the current module and filling the submenu items for it.

6
Mithrandir
Re: help hiding submenu until parent is clicked

Hmmm... I should really get that changed... no need to load the sublinks with $modules[$i]->subLink() if it is not the current module... Thanks for bringing that to my attention, Brian (not much to do with the question, I'm afraid)

7
ackbarr
Re: help hiding submenu until parent is clicked

good. I was thinking the same thing, and made a note to change it. Glad to see we were thinking the same things

8
WarDick
Re: help hiding submenu until parent is clicked
  • 2004/10/21 22:52

  • WarDick

  • Just can't stay away

  • Posts: 890

  • Since: 2003/9/13


Is it just my firefox/mozilla browsers or does this page look amateurish to all?

9
ackbarr
Re: help hiding submenu until parent is clicked

that look a bit better?

10
Mike1234
Re: help hiding submenu until parent is clicked
  • 2004/10/22 12:50

  • Mike1234

  • Just popping in

  • Posts: 16

  • Since: 2004/8/16


ok...thanks.

Final question: is there any easy hack I can do, so that for a given active module that a given user has access to:

Do not display that module name & sublinks in the Main Menu.



I want some, not all, of the modules displayed in the main menu block. This is because those not in the main menu I want to be displayed in their respective blocks instead


thx

Login

Who's Online

185 user(s) are online (115 user(s) are browsing Support Forums)


Members: 0


Guests: 185


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits