[英]how does cobj work in typo3 extension?
I am reading one typo3 extension file: 我正在读取一个typo3扩展文件:
class.tx_jcjob_pi1.php class.tx_jcjob_pi1.php
...
$this->template = $this->cObj->fileResource($this->conf['templateFile']);
...
class.tslib_pibase.php class.tslib_pibase.php
...
var $cObj;
...
class.tslib_content.php class.tslib_content.php
...
function fileResource
...
Question: How does this line work: $this->cObj->fileResource($this->conf['templateFile']);
问题:这行是如何工作的:
$this->cObj->fileResource($this->conf['templateFile']);
? ?
there is not such codes: such as $cObj = new tslib_cObj()
, how did $cObj
get instantiated? 没有这样的代码:例如
$cObj = new tslib_cObj()
,如何实例化$cObj
?
there is no such codes like require_once('class.tslib_content.php');
没有像
require_once('class.tslib_content.php');
这样的代码require_once('class.tslib_content.php');
how could $this->cObj
use the method in class.tslib_content.php
? 怎么可能
$this->cObj
使用方法class.tslib_content.php
?
This is all done by Typo3's page renderer before your plugin's code is executed. 这全部由Typo3的页面渲染器完成,然后执行插件的代码。
Because the class of your plugin extends pi_base
, and pi_base was instantiated by Typo3, alot of functions are already there to leverage. 因为您的插件的类
extends pi_base
,并且pi_base已由Typo3实例化,所以已经有很多函数可以利用。
So if you would not have extended pi_base, $this->cObj
would not be there, and you would need to create it yourself with for example: 因此,如果您没有扩展pi_base,则
$this->cObj
将不存在,并且您需要使用以下示例自己创建它:
$cObj = t3lib_div::makeInstance('tslib_cObj');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.