Question

Added toolbar in joomla 3.0 html.php file. When the addNew button is clicked it displays

An error has occurred. 0 Invalid controller: name='Comboscategories', format=''

html.php file as follows.

<?php    
defined( '_JEXEC' ) or die( 'Restricted access' ); 

class ComboscategoriesViewsStatisticsHtml extends JViewHtml
{
  function render()
  {
    $app = JFactory::getApplication();

    //retrieve task list from model
    $model = new ComboscategoriesModelsStatistics();
    $this->stats = $model->getStats();

    $this->addToolbar();
    /*$this->displayComboslist();*/
    //display
    return parent::render();
  } 


    protected function addToolbar()
    {
        $canDo  = ComboscategoriesHelpersLendr::getActions();

        // Get the toolbar object instance
        $bar = JToolBar::getInstance('toolbar');

        JToolbarHelper::title(JText::_('Combos Category'));


             JToolBarHelper::addNew('Comboscategories.add');
           /* JToolbarHelper::preferences('com_comboscategories');*/
            JToolBarHelper::save();
            JToolBarHelper::cancel();
            JToolBarHelper::deleteList();
            JToolBarHelper::publishList();
            JToolBarHelper::unpublishList();

    }
}

controller.php(display.php)

<?php 

defined( '_JEXEC' ) or die( 'Restricted access' ); 

class ComboscategoriesControllersDisplay extends JControllerBase
{

  public function execute()
  {

    // Get the application
    $app = $this->getApplication();

    // Get the document object.
    $document     = JFactory::getDocument();

    $viewName     = $app->input->getWord('view', 'statistics');
    $viewFormat   = $document->getType();
    $layoutName   = $app->input->getWord('layout', 'default');

    $app->input->set('view', $viewName);

    // Register the layout paths for the view
    $paths = new SplPriorityQueue;

    $paths->insert(JPATH_COMPONENT . '/views/' . $viewName . '/tmpl', 'normal');

    $viewClass  = 'ComboscategoriesViews' . ucfirst($viewName) . ucfirst($viewFormat);
    $modelClass = 'ComboscategoriesModels' . ucfirst($viewName);

    $view = new $viewClass(new $modelClass, $paths);

    $view->setLayout($layoutName);

    // Render our view.
    echo $view->render();

    return true;
  }

}

I searched related to this but i dont find the solution. kindly help me to sort this

Was it helpful?

Solution

Hi im new to joomla but i think that your classes have bad names. it Should be ComboscategoriesViewStatisticsHtml or ComboscategoriesControllerDisplay

OTHER TIPS

You have to use the name of the model: if you have a controller called ComboscategoriesControllersDisplay your call should be JToolBarHelper::addNew('display.add').

Best read this: http://docs.joomla.org/J3.x:Developing_a_MVC_Component/Adding_backend_actions

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top