How to get sidebar in joomla admin

by Jatin   Last Updated July 21, 2016 08:04 AM

I am new to joomla.

I am trying to develop component.

How can I have sidebar in Joomla admin component.

Please help me solve this.



Answers 1


Look at an example: administrator/components/com_installer/views/default/view.php In the view it renders the sidebar:

    // Render side bar.
    $this->sidebar = JHtmlSidebar::render();

Later in a template it outputs the sidebar

    <?php echo $this->sidebar; ?>

But how does it know what to be in the sidebar? In the main controller administrator/components/com_installer/controller.php it established the sidebar

        // Load the submenu.
        InstallerHelper::addSubmenu($vName);

And if you look at the helpder, you can see that it just adds common buttons to the sidebar

    JHtmlSidebar::addEntry(
        JText::_('COM_INSTALLER_SUBMENU_INSTALL'),
        'index.php?option=com_installer',
        $vName == 'install'
    );
    JHtmlSidebar::addEntry(
        JText::_('COM_INSTALLER_SUBMENU_UPDATE'),
        'index.php?option=com_installer&view=update',
        $vName == 'update'
    );

So resuming: Add buttons like this:

JHtmlSidebar::addEntry(
    JText::_('COM_INSTALLER_SUBMENU_INSTALL'),
    'index.php?option=com_installer',
    $vName == 'install'
);

Render sidebar like this

echo JHtmlSidebar::render();
Gruz
Gruz
July 21, 2016 13:50 PM

Related Questions



Where to process data in MVC

Updated August 08, 2015 16:04 PM


Using CodeMirror editor in custom component

Updated October 09, 2016 09:04 AM

Make a checkbox group disappear

Updated March 21, 2017 23:10 PM