Welcome, Guest
Username Password: Remember me

Menu dissapears from certain menu items
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Menu dissapears from certain menu items

Menu dissapears from certain menu items 12 years, 8 months ago #5112

  • rushinge
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
  • Karma: 0
I've got my mobile site working quite well for the most part, however I'm having a problem with my navigation menu disappearing on certain pages.

In the mobile version of my site I have only one, simple, menu for navigation. It's an instance of mod_mj_menu and it is assigned to a menu that has 5 items. Four of the menu items are aliases to other menu items already in use by the desktop version of my site. The first menu item is one of the alias menu items, but it is also set to be the home/default menu item for the mobile site (set using the MJ control panel). All four of these menu items, including the home/default item work just fine.

I'm having a problem with the fifth menu item. It's not a menu item alias, rather it's a menu item of the "category blog" type. When that menu item is selected, the user is taken to that page and the category blog loads just fine, however the Menu itself disappears! Not the menu item, but the entire navigation menu just disappears.

Further investigation indicated that the menu itself is still there, it just has NO menu items. The mod_mj_menu module just renders a blank menu since it doesn't seem to have loaded any menu items when the template is output. At the very least I would expect to see the menu rendered with the "home/default" menu item. It's a Public menu alias to a public menu item that is available to every visitor, logged in or not.

Am I the only one seeing this problem? Anybody have any suggestions as to how I can keep the menu from dropping all menu items when viewing this page?

Re: Menu dissapears from certain menu items 12 years, 8 months ago #5116

  • rushinge
  • OFFLINE
  • Fresh Boarder
  • Posts: 2
  • Karma: 0
Well I finally tracked down the bit of offending code in mod_mj_menu/mod_mj_menu.php:

if($params->get('type')=='submenu')
{
if(!$MobileJoomla->isHome())
$rows = $subrows;
$subrows = array();
}

Seems to execute at inappropriate times. I don't know exactly how $params->get('type') is set but my menu only has one level of items, so $subrows seems to always be empty, at least in my case, however type seems to get set to submenu somewhere because the code block executes and the empty $subrows array is shifted into $rows, resulting in a menu that has no items in it. My workaround was to change the conditional statement as follows:

if($params->get('type')=='submenu' && count($subrows))
{
if(!$MobileJoomla->isHome())
$rows = $subrows;
$subrows = array();
}

Now $subrows is only shifted into $rows if it's not empty. This may not be in keeping with the intended behavior of the module, but it works for all use-cases employed on my site.
  • Page:
  • 1
Time to create page: 0.08 seconds

By continuing to use this site you consent to the use of cookies on your device as described in our cookie policy unless you have disabled them. This site will not function correctly without cookies.

I accept cookies from this site.