[TYPO3-mvc] Loading JS files in Extbase plugins: best practice?

François Suter fsu-lists at cobweb.ch
Tue Mar 29 12:16:05 CEST 2011


Hi,

> AFAIK there is no special Extbase implementation for dealing with
> JSfiles, so your current way is fine. As Sebastian wrote you could also
> use the response object and add some additionalHeaderData there, but
> this won't respect your JS handling settings in TYPO3 (like move all JS
> to bottom etc). So the pageRenderer should be fine.

OK, good.

> Please watch out for the correct terms in case of "redirect" and
> "forward". If a validation error occurs Extbase should forward to the
> new action and not redirect to it. A redirect would be a
> header(location:...) redirect while a forward is only done internally
> without creating a new request and is also passing the incoming
> parameters to the forwarded action (unlike with redirects by default).

Sorry for using the wrong terms, I'm not very familiar with Extbase yet. 
And thanks for educating me :-)

> I think the issue in your case might be a USER/USER_INT one. I suppose
> your "new" action might be cached while your "create" is uncached. I'm
> not sure if TYPO3 is already able to manipulate the HTML header of
> already cached pages with USER_INT plugins - only read about issues
> there once.

Ah yes, that could be the issue. I'm not sure if it has been solved yet.

In my case I can live with a workaround, load the JS file from the TS 
template and add some additional checks inside it so that it does not 
fire actions in views that don't have the proper elements. It will also 
mean that I can't use $pageRenderer->addInlineLanguageLabelArray() to 
load localized labels. Again I can work around that for now because my 
application will run in a single language (phew! ;-) ), but it's an 
embarrassing issue and I'll try to find more information.

Thanks

-- 

Francois Suter
Cobweb Development Sarl - http://www.cobweb.ch


More information about the TYPO3-project-typo3v4mvc mailing list