0
Welcome Guest! Login
0 items Join Now

Menu does not work in custom module

    • Luke Douglas's Avatar
    • Luke Douglas
    • Hero Rocketeer
    • Posts: 322
    • Thanks: 15
    • Another Old Hack!

    Menu does not work in custom module

    Posted 11 years 8 months ago
    • I am redesigning a site so it may change in looks. http://headlandalabama.org/j25

      The problem is that the default Gantry template menu, as well as a RokNavMenu module or a regular Joomla menu module does not work in a custom position.

      I added a 'rt-navigation' position using the instructions. In the index.php file I added the position after the 'rt-header' and before the '</header>' which closes the '<header id="rt-top-surround"> section. This put the 'top', 'header' and 'navigation' all contained within the 'rt-top-surround' area.

        <?php /** End Header **/ endif; ?>
              <?php /** Begin Navigation **/ if ($gantry->countModules('navigation')) : ?>
              <div id="rt-navigation">
                  <div class="rt-container">
                      <?php echo $gantry->displayModules('navigation','standard','standard'); ?>
                      <div class="clear"></div>
                  </div>
              </div>
              <?php /** End navigation **/ endif; ?>
          </header>

      In addition, I added this to the 'rt-top-surround' line to check for published 'navigation' modules:
        <?php /** Begin Top Surround **/ if ($gantry->countModules('top') or $gantry->countModules('header') or $gantry->countModules('navigation')) : ?>

      In the templateDetails.xml file, I inserted the 'navigation' positions between the 'header' and the 'showcase'.
       
              <position>header-f</position>
              <position>navigation-a</position>
              <position>navigation-b</position>
              <position>navigation-c</position>
              <position>navigation-d</position>
              <position>navigation-e</position>
              <position>navigation-f</position>
              <position>showcase-a</position>
       

      In the template-options.xml, between the 'header' fields and the 'showcase' fields, I added this:
      <fields name="navigation" type="position" label="NAVIGATION_POS" description="LAYOUT_POS_DESC">
                  <field name="layout" type="positions" default="3,3,3,3" label="">
                      <schemas>1,2,3,4,5,6</schemas>
                      <words>2,3,4,5,6,7,8,9,10</words>
                  </field>
                  <field name="showall" type="toggle" default="0" label="FORCE_POS"/>
                  <field name="showmax" type="showmax" default="6" label="POS_COUNT"/>
              </fields>

      In the en-GB.tpl_gantry.ini file, I added this to display 'Navigation Positions' on the layout tab:
      NAVIGATION_POS="Navigation Positions"

      Now all of this is pretty standard stuff for adding a custom module.

      However, if I set the default Gantry menu to 'navigation-a' or any other 'navigation-XX' position, the menu does not work. I tested this with a RokNavMenu and a regular Joomla Menu module also. None of them would work when assigned to any 'navigation-XX' position. Once I change the module position to 'header-a', they all worked. I double checked my custom changes and I don't see any problems there.

      On the home page, I unpublished all articles and disabled all modules just to 'ensure' there were no other conflicts. When I set the Gantry template default menu settings to 'navigation-a', it displays but doesn't work. I changed the Gantry template menu position to 'header-a', it displays and works. So I took both of the source codes for each page and compared with an online checker and the only differences were the <div id="rt-navigation"> and the <div id="rt-header"> lines. Everything else matched up.

      I've attached the comparision to both page source files from the online checker.

      I've gone about as far as I can in trying to find the problem so if anyone sees something I missed, I would appreciate your feedback.

      Luke
    • Just another old hacker!
  • Re: Menu does not work in custom module

    Posted 11 years 7 months ago
    • Hello Luke,

      In templates/gantry/less/template.less (Line 45 if you haven't made changes to that file):
      #rt-header, #rt-top {
          z-index: 2;
          position: relative;
      }

      Add #rt-navigation to the list:
      #rt-header, #rt-top, #rt-navigation {
          z-index: 2;
          position: relative;
      }
    • Kind regards,
      Reggie

      Learn to code for free.
      www.freecodecamp.org
    • Luke Douglas's Avatar
    • Luke Douglas
    • Hero Rocketeer
    • Posts: 322
    • Thanks: 15
    • Another Old Hack!

    Re: Menu does not work in custom module

    Posted 11 years 7 months ago
    • Reggie,

      You da' man! That fixed it. However, I created a 'template-custom.less' file to put these changes to ensure that no future updates overwrite this change.

      Now WHY isn't that tidbit of information in the Gantry Framework documentation? :evil:

      Luke
    • Just another old hacker!
  • Re: Menu does not work in custom module

    Posted 11 years 7 months ago
    • Hello Luke,

      Good question.

      I'll look into getting a tidbit added into our docs specifically about this issue when adding a custom module position.
    • Kind regards,
      Reggie

      Learn to code for free.
      www.freecodecamp.org

Time to create page: 0.129 seconds