[TYPO3-dev] Calling $this->cObj->CONTENT from inside a plugin denied

Sebastian Gebhard sebastiangebhard at hoch2.de
Mon Mar 1 15:08:19 CET 2010


Am 01.03.10 14:50, schrieb Dmitry Dulepov:
> Hi!
>
> On 2010-03-01 14:57:44 +0200, Sebastian Gebhard said:
>> Why is there this restriction? Why am I not allowed to render a
>> CONTENT element inside a plugin?
>
> Because you risk overwriting current content data...
>
> Just make a new copy of cObj and use it:
>
> $cObj = t3lib_div::makeInstance('tslib_cObj');
> $cObj->start(array(), '');
>
> By the way, you should not call CONTENT directly, you should use
> cObjGetSingle() call instead.

//$currentRecord = $GLOBALS['TSFE']->currentRecord;
//unset($GLOBALS['TSFE']->currentRecord);

$CONTENTcObj = t3lib_div::makeInstance('tslib_cObj');
$CONTENTcObj->start(array(), '');
$content = $CONTENTcObj->cObjGetSingle('CONTENT', $contentConf);

//$GLOBALS['TSFE']->currentRecord = $currentRecord;

Does not work (Means whole Plugin is not rendered). Activating the 
commented-out lines, makes it work - but it's rather dirty.

So using a new cObj does not help in my case
>
> Get my TYPO3 extension development book. It has lots of stuff like that
> in examples...
I have it already ;)





More information about the TYPO3-dev mailing list