简体   繁体   English

Joomla中的后端操作无效

[英]Backend action in Joomla doesn't work

when i create action and then click on it, i get js error 当我创建动作,然后单击它,我得到js错误

Uncaught TypeError: Cannot read property 'task' of undefined (in chrome) 未捕获的TypeError:无法读取未定义的属性“任务”(在chrome中)
TypeError: b is undefined (in ff) TypeError:b未定义(以ff为单位)

my code is: 我的代码是:

view.html.php 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 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();
    }        
}

answer is simple as hell... 答案很简单就像......

i forgot to add form in view 我忘了在视图中添加表单

<form action="index.php" method="post" name="adminForm">

    something

    <input type="hidden" name="option" value="com_obsh" />
    <input type="hidden" name="task" value="" />
    <input type="hidden" name="boxchecked" value="0" />
</form>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM