0

I am reading one typo3 extension file:

class.tx_jcjob_pi1.php

...
$this->template = $this->cObj->fileResource($this->conf['templateFile']);
...

class.tslib_pibase.php

...
var $cObj;
...

class.tslib_content.php

...
function fileResource
...

Question: How does this line work:$this->cObj->fileResource($this->conf['templateFile']);?

  1. there is not such codes: such as $cObj = new tslib_cObj(), how did $cObj get instantiated?

  2. there is no such codes like require_once('class.tslib_content.php'); how could $this->cObj use the method in class.tslib_content.php?

4

1 回答 1

1

这一切都是在执行插件代码之前由 Typo3 的页面渲染器完成的。

因为你的插件类extends pi_base和 pi_base 是由 Typo3 实例化的,所以已经有很多函数可以利用。

因此,如果您没有扩展 pi_base,$this->cObj则不会存在,您需要自己创建它,例如:

$cObj = t3lib_div::makeInstance('tslib_cObj');
于 2013-07-26T10:26:52.077 回答