[TYPO3-mvc] Instantiate extbase action controller inside tslib_fe hook

Thomas "Thasmo" Deinhamer thasmo at gmail.com
Fri Oct 30 19:20:59 CET 2009


Okay, I try to explain what I want to do.

Based on the Yahoo performance rules I want to merge and compress
all CSS and JS data into a single file. In case of the JS file, it
should also be possible to be placed right before the closing body tag.

The approach I'm targeting at, is to search for all CSS and JS data
inside the already generated HTML content. The reason for this is the
fact, that several extensions DON'T use includeCSS, includeJS or they
rely on several TSFE variables like $additionalJavaScript or
$additionalCSS etc. In the end it's very difficult to gather all
CSS and JS data which will get rendered, before the HTML is built.

Furthermore non-cachable frontend plugins will process their
headerdata AFTER the content is retrieved from the cache,
based on the <!--HD[]--> marker.

So imho the cleanest and most efficient solution is to retrieve all
data right after the whole HTML page is generated.

My approach for now, is a TSFE Hook called 'contentPostProc-output',
which will get called right after the HHML is fully processed.

In the hook itself I want to put my code to find al CSS and JS files,
which then will get merged and compressed, based on the settings of
the extension itself.

One problem raised here. The extension configuration is available
ONLY ONCE, if the cache is enabled - on the second and all the further
requests, the hook is still called, but the extension configuration
is not available inside the $GLOBALS array.

My 'hack' for now is to serialize the extension configuration on the
first call, write it into a text-file, and to retrieve and deserialize
it on the next calls.

My idea now, was to put all the search/compress code into a frontend
plugin, which then gets called inside the hook, hoping that doing it
this way, the configuration is available inside the frontend plugin.

FYI: Of course I'm trying to build up an efficient caching mechanism
inside the hook, so that the delay for compressing is not too big
on the initial request of the page.

Is there a better solution to achieve this, or I'm on the right way?
How to call the frontend plugin (action controller) inside the hook,
which then should process the generated HTML source?

Thanks a lot for your experience-based thoughts on this,
and your time to read and response to it!! =o)


Sebastian Kurfürst schrieb:
> Hey,
> 
> what do you want to archive? Maybe there is a different way...
> 
> Greets,
> Sebastian


More information about the TYPO3-project-typo3v4mvc mailing list