0

在 joomla 3.0 html.php 文件中添加了工具栏。单击 addNew 按钮时,它会显示

发生了错误。0 无效的控制器:名称='Comboscategories',格式=''

html.php 文件如下。

<?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();

    }
}

控制器.php(显示.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;
  }

}

我搜索了与此相关的但我没有找到解决方案。请帮我整理一下

4

2 回答 2

0

嗨,我是 joomla 的新手,但我认为您的课程名声不好。它应该是ComboscategoriesViewStatisticsHtmlComboscategoriesControllerDisplay

于 2013-09-27T10:42:24.883 回答
0

您必须使用模型的名称:如果您有一个名为 ComboscategoriesControllersDisplay 的控制器,您的调用应该是 JToolBarHelper::addNew('display.add')。

最好阅读:http ://docs.joomla.org/J3.x:Developing_a_MVC_Component/Adding_backend_actions

于 2014-08-06T15:15:10.197 回答