[TYPO3-dev] JavaScript and USER_INT plugins

Krystian Szymukowicz t33k at prolabium.com
Tue Mar 29 13:05:40 CEST 2011


W dniu 2011-03-29 13:03, Krystian Szymukowicz pisze:
> W dniu 2011-03-29 12:28, François Suter pisze:
>> Hi all,
>>
>> I can't remember what the situation is about the issue of not being able
>> to load JavaScript files from inside a USER_INT plugin, when the rest of
>> the page is already cached. I know there was a lot of discussion but
>> were there results? Workarounds?
>>
>> Cheers
>>
>
>
> I do somthing like that:
>
> function main($content, $conf) {
>
> if ($this->cObj->getUserObjectType() == tslib_cObj::OBJECTTYPE_USER) {
>
> // add you css and js the standard way - it will be cached
> $pageRenderer = $GLOBALS['TSFE']->getPageRenderer();
> $pageRenderer->addJsFile($clientPublicFolder .
> 'JavaScript/plupload.full.min.js');
>


upps!!! forgot one important line  $this->cObj->convertToUserIntObject();

So this sould looks like:


function main($content, $conf) {

if ($this->cObj->getUserObjectType() == tslib_cObj::OBJECTTYPE_USER) {

// add you css and js the standard way - it will be cached
$pageRenderer = $GLOBALS['TSFE']->getPageRenderer();
$pageRenderer->addJsFile($clientPublicFolder . 
'JavaScript/plupload.full.min.js');


$this->cObj->convertToUserIntObject();
// early return
return;
}


// later part that returns real content
....

}



-- 
grtz
Krystian Szymukowicz




More information about the TYPO3-dev mailing list