所以我试图创建我的第一个组件,为此我创建了以下控制器:
<?php
defined('_JEXEC') or die ('Access denied!');
/**
* Created by JetBrains PhpStorm.
* User: Marc
* Date: 18-08-13
* Time: 02:18
* To change this template use File | Settings | File Templates.
*/
jimport( 'joomla.application.component.controller' );
class MyCompController implements JController{
function create(){
echo "Welcome to create";
}
function delete (){
$id =JRequest::getVar('id');
echo "you want to delete "-$id;
}
}
现在我对 joomla 不是很熟悉,只能在哪里找到 2.5 的文档
$controller = JController::getInstance('MyComp');
是获取控制器实例的相关方法。
我查看了接口,但 JController 接口没有提供 getInstance 方法,因此我尝试过:
$controller = JController::getApplication('MyComp');
但没有运气。
那么如何获得控制器呢?