在joomla 3.0中添加工具栏



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

出现错误。0无效控制器:name="组合类别",format=''

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

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;
  }
}

我搜索了与此相关的内容,但没有找到解决方案。请帮我对这个进行排序

嗨,我是joomla的新手,但我认为你的类有不好的名字。它应该是ComboscategoriesViewStatisticsHtmlComboscategoriesControllerDisplay

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

最好阅读以下内容:http://docs.joomla.org/J3.x:Developing_a_MVC_Component/Adding_backend_actions

相关内容

  • 没有找到相关文章

最新更新