Search code examples
joomlajoomla-extensionsjoomla-template

How to use Joomla left sidebar position for a custom component menu


A client web site uses a Joomla template with lots of modules in the left column, but for the custom component I'm designing, those modules must be replaced by a vertical menu. The hack solution I came up with is to hide those modules with CSS:

div#leftpad > div {
    display:none;
}

and then insert a <div id='compmenu'> in <div id='leftpad'> with javascript and set display:block. With jQuery, I could do

jQuery('#compmenu').appendTo('#leftpad').show();

The component displays a google map, so javascript is required anyway. Any Joomla experts here know of a more elegant or straightforward method to achieve the same result?


Solution

  • Why don't you use the build in Menu-Bind for Modules to hide them when your Module or Component is displayed, this would be a clean way. I think your Module/Comp is bound to a Menu item.

    Edit: For sure your client have to implement your Module/Comp the right way. Is is very bad to do something like this with a hack.

    • Create Menu-Item for your component (programtic)
    • Create a hidden menu
    • Add your component to that menu
    • Do unbound all modules from this menue

    The Joomla API hold a good series of Tutorials about building components. I gone through them in the past but as I see they have improved them. As I understand your component is relatively straight forward so the default menu should be what you want. It is described in the install XML

     <administration>
      <!-- Administration Menu Section -->
      <menu>MyMenuLink</menu>
    
      <!-- some other stuff -->
    
     </administration>
    

    And will be available at the Joomla! menumanager after your client has installed your component. So I think it will be not that hard for you.