当我创建动作,然后单击它,我得到js错误
原文链接:https://www.f2er.com/php/137555.html未捕获的TypeError:无法读取未定义的属性“任务”(在chrome中)
TypeError:b未定义(以ff为单位)
我的代码是:
view.html.PHP
<?// no direct access defined( '_JEXEC' ) or die( 'Restricted access' ); jimport( 'joomla.application.component.view'); class ObshViewObsh extends JView { function display($tpl = null) { $task = JRequest::getVar('task',''); switch($task){ case 'config': $this->config();break; default: $this->windows(); } parent::display($tpl); } function windows(){ JToolBarHelper::title( JText::_( 'Общежития' ),'generic.png' ); JToolBarHelper::custom('config','options','','Настройки',false); //<<< --- this link doesn't work } function config(){ JToolBarHelper::title( JText::_( 'Общежития - настройка компонента' ),'generic.png' ); JToolBarHelper::apply('edit_config'); JToolBarHelper::cancel('cancel'); } }
Controller.PHP这样
<?PHP error_reporting(E_ALL); // No direct access defined( '_JEXEC' ) or die( 'Restricted access' ); jimport('joomla.application.component.controller'); class ObshController extends JController { function config(){ JRequest::setVar( 'view','obsh' ); JRequest::setVar( 'layout','config' ); JRequest::setVar( 'hidemainmenu',1 ); parent::display(); } }