Joomla Stack Exchange is a question and answer site for Joomla! administrators, users, developers and designers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I can't find any tutorials on how to use the JHtmlSidebar Utility Class.

This comes close to it: Creating a toolbar for your component, but it is very vague. It mentions $this->sidebar, which suggest that the View class should have an attribute sidebar. But sidebar attribute doesn't exist in the View class.

I tried using this:

echo $this->sidebar = JHtmlSidebar::render();

It does indeed echo the sidebar, but it sits at top or bottom of my view, not on the side. I'm just wondering if there is a way to let Joomla do the rendering for me, instead of creating my own layout.

Some help or links to useful tutorial on the use of admin side bar would be much appreciated. Thank you.


// No direct access to this file
defined('_JEXEC') or die('Restricted access');


class HelloWorldViewHelloWorld extends JViewLegacy {
    public function display($tpl = NULL){
        $this->sidebar = JHtmlSidebar::render();

    protected function addToolbar(){
        require_once JPATH_COMPONENT . '/helpers/helloworld .php';
        JToolBarHelper::title( 'Hello World', 'helloworld' );
        JToolBarHelper::preferences('com_helloworld', '500');


class HelloWorldHelper extends JHelperContent
    public static function addSubmenu($vName)
            $vName == 'profile'
share|improve this question
up vote 5 down vote accepted

You firstly need to create a helper file, for example:


and in this file, add the following:

class HelloWorldHelper extends JHelperContent
    public static function addSubmenu($vName)
            $vName == 'banners'

Change VIEWNAME and the value for $vName to the view for your component that you wish to add the sidebar to.

Then, in your view.html.php file, call it using the following:


and of course, the following is required to render the sidebar which you can put below the code above:

$this->sidebar = JHtmlSidebar::render();

If you have a look at the Banners component that comes packaged with Joomla, it will provide a good example.


If forgot to mention, inside your addToolbar() function in the view.html.php file, you will need to call the helper file like so:

require_once JPATH_COMPONENT . '/helpers/hellowworld.php';

Update 2:

Sorry, I'm not on the ball today. You will need to add the following to your default.php in views/VIEWNAME/tmpl:

<div id="j-sidebar-container" class="span2">
    <?php echo $this->sidebar; ?>
<div id="j-main-container" class="span10">
     // Main part of the component view
share|improve this answer
Any thoughts on how easy/difficult it would be to use the sidebar for a component's F/E? – GDP Aug 18 '14 at 14:29
@GDP, by "F/E", are you referring to the frontend? – Lodder Aug 18 '14 at 14:41
Thanks, I used your code and followed the banners example. But now it's telling me "Fatal error: Class 'HelloWorldHelper' not found in ..\com_helloworld\views\myview\view.html.php on" Do I need to instantiate the helper somewhere? I've never used one before... – user3804927 Aug 18 '14 at 14:43
I made sure it's the same by copying. PHPStorm is even able to link the file. So I don't understand why it's not in scope when I test it. – user3804927 Aug 18 '14 at 14:51
@user3804927 - See my updated answer. Sorry I forgot about that :/ – Lodder Aug 18 '14 at 14:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.