【问题标题】:addToolbar in joomla 3.0joomla 3.0 中的添加工具栏
【发布时间】:2013-06-25 12:50:18
【问题描述】:

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

发生了错误。 0 无效的控制器: name='Comboscategories', 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;
  }

}

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

【问题讨论】:

    标签: toolbar joomla3.0 jtoolbar


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

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

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

      【讨论】:

        猜你喜欢
        • 2012-07-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-12-02
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多