Wednesday, July 24, 2013

Menu not displaying in Joomla - How to correct it?

Learn how to correct the issue of menu not displaying in Joomla front end and back end.

Joomla logo

At some point of time in web development using Joomla Content Management Framework, you may come across this issue. Lets see how to rectify it.

There are many reasons for this issue. 

1. First of all, check whether the menu is assigned in the correct position.
Choose the correct position to display.

2. Secondly check whether the template is assigned with the respective menu. In some cases we need to manually assign all the menu to a particular template. To do that go to Extensions > Template Manager and look for the section menu assignment. Select all the menu for the template and press Save. Also check Extensions > Module Manager and click on the respective menu module. You must ensure that the menu is assigned to the needed pages where menu should be displayed.

3. There may still be in some cases the menu will not be displaying. In that case you need to do the following changes in the code. This usually happens when the PHP of your system or server is upgraded to 5.3+. Make sure you write down the changes you are making as it will make a log of all the changes as well as help you in troubleshooting it later.

Take the file yourdirectory/libraries/joomla/html/html.php

Search for the line of code:

return call_user_func_array( array( $className, $func ), $args );     

Change the code to: 

return call_user_func_array( array( $className, $func ), &$args );    

here the parameter $args is passed by reference instead of value so that the function can modify the variable where as when passed by value the variable $args is not changed outside the function.

You must also do the following changes to the helper file of the module. i.e. the file yourdirectory/modules/mod_mainmenu/helper.php where mod_mainmenu should be replaced by the respective menu module.

Search for the line of code:

function buildXML(&$params)               

Change the code to:

function buildXML($params)                          

Please contact me or put a comment if you have any doubt regarding this. Happy coding..

1 comment:

  1. Thanks for the information. Its very useful