New component not showing toolbar

This forum is for general questions about extensions for Joomla! 2.5.

Moderators: pe7er, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
charltondurie
Joomla! Apprentice
Joomla! Apprentice
Posts: 47
Joined: Thu Apr 30, 2009 8:42 pm

New component not showing toolbar

Post by charltondurie » Thu Jan 20, 2011 4:18 am

I am creating a new video component and am fairly new to all this. In the backend of this component the toolbar and title are not showing and I have done all that the Joomla 1.6 Component tutorial says to implement it. Can anyone give me any pointers as to what I am missing? Below are the related files:

admin/views/videos/view.html.php

Code: Select all

<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
 
// import Joomla view library
jimport('joomla.application.component.view');
 
/**
 * Video View
 */
class VideoViewVideos extends JView
{
        /**
         * Videos view display method
         * @return void
         */
        function display($tpl = null) 
        {
                // Get data from the model
                $items = $this->get('Items');
                $pagination = $this->get('Pagination');
 
                // Check for errors.
                if (count($errors = $this->get('Errors'))) 
                {
                        JError::raiseError(500, implode('<br />', $errors));
                        return false;
                }
                // Assign data to the view
                $this->items = $items;
                $this->pagination = $pagination;
 
                // Display the template
                parent::display($tpl);
        }
        
 		/**
         * Setting the toolbar
         */
        protected function addToolBar() 
        {
                JToolBarHelper::title(JText::_('Videos'));
                JToolBarHelper::deleteListX('', 'videos.delete');
                JToolBarHelper::editListX('video.edit');
                JToolBarHelper::addNewX('video.add');
        }
}
admin/views/videos/tmpl/default.php

Code: Select all

<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted Access');
// load tooltip behavior
JHtml::_('behavior.tooltip');
?>
<form action="<?php echo JRoute::_('index.php?option=com_video'); ?>" method="post" name="adminForm">
        <table class="adminlist">
                <thead><?php echo $this->loadTemplate('head');?></thead>
                <tfoot><?php echo $this->loadTemplate('foot');?></tfoot>
                <tbody><?php echo $this->loadTemplate('body');?></tbody>
        </table>
        <div>
                <input type="hidden" name="task" value="" />
                <input type="hidden" name="boxchecked" value="0" />
                <?php echo JHtml::_('form.token'); ?>
        </div>
</form>

binhle410
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed Mar 24, 2010 10:08 am
Contact:

Re: New component not showing toolbar

Post by binhle410 » Thu Jan 20, 2011 8:31 am

Nope, I don't think you followed exactly what the tutorials say.

You missed this inside your display function

// Set the toolbar
$this->addToolBar();


// Display the template
parent::display($tpl);

Cheers :pop
free Joomla Tutorials for everyone http://joomla101.org (ver 1.6.x) joomla tutorials
Let's help spread the word of Joomla. I love it.

charltondurie
Joomla! Apprentice
Joomla! Apprentice
Posts: 47
Joined: Thu Apr 30, 2009 8:42 pm

Re: New component not showing toolbar

Post by charltondurie » Thu Jan 20, 2011 9:24 am

Doh thanks for that.


Locked

Return to “Extensions for Joomla! 2.5”