[TYPO3] Refer to plug-in in plug-in
Dmitry Dulepov [typo3]
dmitry at typo3.org
Fri Aug 8 17:20:13 CEST 2008
Hi!
Pankaj Lele wrote:
> Basically any plugin is a USER object. The simpler way is to call the
> $this->cObj->USER() method in your plugin.
>
> E.g. you would like to render a smoothgallery plugin you can do it with
> code:
>
> $conf =
> $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_rgsmoothgallery_pi1.'];
> //this reads TS setup for the plugin.
> $content = $GLOBALS['TSFE']->cObj->USER($conf); //calls plugin to get
> the content
It should be a separate cObject or you risk corrupting TSFE data. Additionally, the call to USER has different parameters than you use. USER is an internal function, it should not be called directly.
Correct code is:
$cObjType = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_rgsmoothgallery_pi1'];
$conf = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_rgsmoothgallery_pi1.'];
$cObj = t3lib_div::makeInstance('tslib_cObj');
$cObj->start(array(), '_NO_TABLE');
$content = $cObj->cObjGetSingle($cObjType, $conf);
--
Dmitry Dulepov
TYPO3 Core team
My TYPO3 book: http://www.packtpub.com/typo3-extension-development/book
In the blog: http://typo3bloke.net/post-details/typo3_code_formatting_in_eclipse/
More information about the TYPO3-english
mailing list