I have some dropdown primary links menus. I can't seem to get megamenus to replace that. It only will allow me to place mega menus where I have blocks. However, the primary links do not operate as a block. They just sort of appear on the menu bar.

I'm using acquia Prosper theme. I wonder if that may have something to do with it?

Comments

Anonymous’s picture

Acquia Prosper is probably loading the primary menu in the page template. You could replace the call to primary links to theme the megamenu block. That would place the themed megamenu output in the same place you are currently displaying the primary menu.

Anonymous’s picture

In Acquia Prosper lines 74 - 81:

<!-- primary-menu row: width = grid_width -->
      <div id="header-primary-menu-wrapper" class="header-primary-menu-wrapper full-width">
        <div id="header-primary-menu" class="header-primary-menu row <?php print $grid_width; ?>">
          <div id="header-primary-menu-inner" class="header-primary-menu-inner inner clearfix">
            <?php print theme('grid_block', $primary_links_tree, 'primary-menu'); ?>
          </div><!-- /header-primary-menu-inner -->
        </div><!-- /header-primary-menu -->
      </div><!-- /header-primary-menu-wrapper -->

You'll need to replace <?php print theme('grid_block', $primary_links_tree, 'primary-menu'); ?> with a call to theme the megamenu block. If you are calling the megamenu block for primary links then the code becomes:

<!-- primary-menu row: width = grid_width -->
      <div id="header-primary-menu-wrapper" class="header-primary-menu-wrapper full-width">
        <div id="header-primary-menu" class="header-primary-menu row <?php print $grid_width; ?>">
          <div id="header-primary-menu-inner" class="header-primary-menu-inner inner clearfix">
            <?php 
                  $megamenu = module_invoke('block', 'block', 'megamenu', 'primary-links');
                  print $megamenu['content'];
             ?>
          </div><!-- /header-primary-menu-inner -->
        </div><!-- /header-primary-menu -->
      </div><!-- /header-primary-menu-wrapper -->
Anonymous’s picture

That code goes in the page.tpl.php of the Acquia Prosper theme.

xl_cheese’s picture

Thanks for the replies! I may experiment with this, but being I'm about to put my site into production I may hold off on this menu until it's more stable. I'm looking forward to it's development! I sort of got the nice menu module to do a multi column menu, but it was a little hokey getting it there.

xl_cheese’s picture

I finally got around to trying this out. Unfortunately, I could not make it work. My primary links would not appear with this code change. Thanks for the help.

Anonymous’s picture

Ok, I downloaded Acquia Prosper to try it out myself. And you are right, I made a mistake (shows me to write code blind) :-)

The correct call is:

   $megamenu = module_invoke('megamenu', 'block', 'view', 0);
   print $megamenu['content'];

The zero in the module_invoke() call, happens to be the block # for primary links (for me, it might be different for you).

That worked for me, it spit out the megamenu in the primary-menu area. Alternatively, you could add a region and then just place the megamenu block in it.

xl_cheese’s picture

Thanks again. My primary links Block # doesn't seem to be 0. How do you find that number?

Anonymous’s picture

Do you have other megamenu blocks enabled?

xl_cheese’s picture

Nope.

Maybe I'll try a local install to see if it works there.

Anonymous’s picture

Go to block administration (admin->build->block) then click on configure next to the primary-links megamenu block (or whatever block you are interested in). Notice that the url reads www.example.com/admin/build/block/configure/megamenu/#

That last number is what you want.

Anonymous’s picture

Status: Active » Fixed
priyanka.salunke’s picture

i also wnt to replace my primary links wth superfish menu plz help me out.......

grimfandango’s picture

There are two menu modules that I know of that support Superfish menus.

http://drupal.org/project/superfish

http://drupal.org/project/nice_menus

These projects are unrelated to the Megamenu module.

GrimF

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

rickyrocks’s picture

thanks a lot for helping with code. does same code work on acquia marina theme ?

Regards

rickyrocks’s picture

thanks a lot . this code works perfectly fine.

Regards

brianbrarian’s picture

Thanks ... just what I needed. The code from #6 works great in the Simpler theme.

jantoine’s picture

Might be an easier solution, but I used

<?php print megamenu_theme_menu_tree('main-menu'); ?>

Cheers,

Antoine

Anonymous’s picture

Won't this be overwritten on update? Silly question? Maybe. :) But I was wondering if you add or change page.tpl.php, won't that be overwritten when your theme needs a security update? I'm using this to replace the primary links menu with one using the Megamenus module, but want to make sure I do this properly so I won't have to fix it every single time we update our theme. Thanks!

jantoine’s picture

Hi abuchold,

This is a separate general theming question. Please see http://drupal.org/community for community support and http://drupal.org/documentation/theme for theming documentation.

To briefly answer your question, many drupalistas use a "base" contributed theme and create their own custom sub-theme based on the chosen base theme. If the base theme has a new release, a simple diff can be used to detect if any customized files used in the sub-theme need updating.

kirtimansharma’s picture

The code in #6 works just. Are there any tutorials for making custom skins for mega menu too?