Hi

I've been trying for several days to understand how the mobile menu works

I tried to assign modules with off-canvas position to the various menus but it doesn't work

trying to understand the default.php, I found the lines

<div id="gkMobileMenu"<?php if($this->API->get('menu_type', 'off-canvas') === 'off-canvas') : ?> class="off-canvas"<?php endif; ?>>
					<span id="static-aside-menu-toggler" class="fas fa-bars"><span class="element-invisible">static-aside-menu-toggler</span></span>
				</div>
<?php if($this->API->get('menu_type', 'off-canvas') === 'off-canvas') : ?>
<i id="close-menu">&times;</i>
<nav id="aside-menu">
<div>
<?php if($this->API->modules('menu_top')) : ?>
<div id="gk-menu-top">
<jdoc:include type="modules" name="menu_top" style="none" />
</div>
<?php endif; ?> <?php $this->asidemenu->loadMenu($this->API->get('menu_name','mainmenu'));
 $this->asidemenu->genMenu($this->API->get('startlevel', 0), $this->API->get('endlevel',-1));
 ?> <?php if($this->API->modules('menu_bottom')) : ?> <div id="gk-menu-bottom"> <jdoc:include type="modules" name="menu_bottom" style="none" /> </div> <?php endif; ?> </div> </nav> <?php endif; ?>

As far as I can tell, I assume this is the mobile menu

If I examine the html I actually find

<nav id="aside-menu" class="menu-open">
<div class="aside-menu-inner">
<div class="aside-menu-wrap">
<div class="gkAsideMenu">
<ul class="gkmenu level0"><li class="first"><a href="http://mysite.com/" class=" first">Home</a></li></ul>
</div>
<div class="gkAsideMenu">
<ul class="gkmenu level0"><li class="first"><a href="http://mysite.com/" class=" first">Home</a></li></ul>
</div> </div>

</div>
</nav>

I have only "Home" as menu item, how can I make this menu take the same menu items that are seen in desktop mode?

Thanks

Hi guys, I saw you logged in while I was trying to make the mobile menu visible, hope I didn't fucked up something while you were doing something. I'll not do anything about menus from now on till I get some info from you.

Anyway what I did was trying stuff on default.php like adding this stuff

<div id="gkMobileMenu"<?php if($this->API->get('menu_type', 'off-canvas') === 'off-canvas') : ?> class="off-canvas"<?php endif; ?>>
    <span id="static-aside-menu-toggler" class="fas fa-bars"><span class="element-invisible">static-aside-menu-toggler</span></span>
    <nav id="aside-menu">
        <div class="aside-menu-inner">
            <div class="aside-menu-wrap">
                <?php
                    // Carica e genera il menu di sinistra (mainmenu-left)
                    $this->asidemenu->loadMenu($this->API->get('menuname','mainmenu-left'));
                    $this->asidemenu->genMenu($this->API->get('startlevel', 0), $this->API->get('endlevel',-1));
                    
                    // Carica e genera il menu di destra (mainmenu-right)
                    $this->asidemenu->loadMenu($this->API->get('menuname','mainmenu-right'));
                    $this->asidemenu->genMenu($this->API->get('startlevel', 0), $this->API->get('endlevel',-1));
                ?>
            </div>
        </div>
    </nav>
</div>

or stuff like

<div class="gkMainMenuWrap gkMainMenuLeft">
    <?php if($this->API->get('menu_type', 'off-canvas') === 'classic') : ?>
        <?php
            $lang = JFactory::getLanguage()->getTag();
            $menuName = ($lang === 'en-GB') ? 'mainmenu-left-en' : 'mainmenu-left-it';
            $this->mainmenu->loadMenu($this->API->get('menuname', $menuName));
            $this->mainmenu->genMenu($this->API->get('startlevel', 0), $this->API->get('endlevel', -1));
        ?>
    <?php endif; ?>
</div>

<div class="gkLogoWrap">
    <?php $this->layout->loadBlock('logo'); ?>
</div>

<?php if($this->API->get('show_menu', 1) || $this->API->modules('search')) : ?>
    <div class="gkMainMenuWrap gkMainMenuRight">
        <?php if($this->API->get('show_menu', 1) && $this->API->get('menu_type', 'off-canvas') === 'classic') : ?>
            <?php
                $lang = JFactory::getLanguage()->getTag();
                $menuNameRight = ($lang === 'en-GB') ? 'mainmenu-right-en' : 'mainmenu-right-it';
                $this->mainmenu->loadMenu($this->API->get('menuname', $menuNameRight));
                $this->mainmenu->genMenu($this->API->get('startlevel', 0), $this->API->get('endlevel', -1));
            ?>
        <?php endif; ?>

        <?php if($this->API->modules('search')) : ?>
            <div id="gkSearch">
                <span class="fa fa-search"></span>
            </div><!-- #gkSearch -->
        <?php endif; ?>

        <?php if($this->API->modules('lang')) : ?>
            <div id="gkLang" class="clearfix">
                <jdoc:include type="modules" name="lang" style="none" />
            </div>
        <?php endif; ?>

        <div id="gkMobileMenu"<?php if($this->API->get('menu_type', 'off-canvas') === 'off-canvas') : ?> class="off-canvas"<?php endif; ?>>
            <span id="static-aside-menu-toggler" class="fas fa-bars"><span class="element-invisible">static-aside-menu-toggler</span></span>
            <nav id="aside-menu">
                <div class="aside-menu-inner">
                    <div class="aside-menu-wrap">
                        <?php
                        // Carica e genera il menu di sinistra (mainmenu-left)
                        $this->asidemenu->loadMenu($this->API->get('menuname', $menuName));
                        $this->asidemenu->genMenu($this->API->get('startlevel', 0), $this->API->get('endlevel', -1));

                        // Carica e genera il menu di destra (mainmenu-right)
                        $this->asidemenu->loadMenu($this->API->get('menuname', $menuNameRight));
                        $this->asidemenu->genMenu($this->API->get('startlevel', 0), $this->API->get('endlevel', -1));
                        ?>
                    </div>
                </div>
            </nav>
        </div>
    </div>
<?php endif; ?>

Basically I put my hand only in this part of the code, but not knowing what I was doing, just trying.

I ended up loosing the desktop menu, so now I quit, I really have no knowledge and reading around internet and change code this way make no sense

the default.php is the backup I saved before my trials, or at least I think, but anyway I put my hand only there. I have backups of backups of backups and now I don't really know, sorry

Thanks again

I DID IT!!!

I made this change and now it's working!

<div class="aside-menu-inner">
			<div class="aside-menu-wrap">
				<?php
					$lang = JFactory::getLanguage()->getTag();
					$menuName = ($lang === 'en-GB') ? 'mainmenu-left-en' : 'mainmenu-left-it';
					$this->asidemenu->loadMenu($this->API->get('menuname',$menuName));
					$this->asidemenu->genMenu($this->API->get('startlevel', 0), $this->API->get('endlevel',-1));
				?>

				<?php
					$lang = JFactory::getLanguage()->getTag();
					$menuNameRight = ($lang === 'en-GB') ? 'mainmenu-right-en' : 'mainmenu-right-it';
					$this->asidemenu->loadMenu($this->API->get('menuname', $menuNameRight));
					$this->asidemenu->genMenu($this->API->get('startlevel', 0), $this->API->get('endlevel',-1));
				?>
			</div>
5 days later
Write a Reply...
You need to Login to view replies.