[TYPO3-mvc] render fluid partial in backend Scheduler task

typo3 at litedesigns.nl typo3 at litedesigns.nl
Thu Aug 30 09:40:55 CEST 2012


Hi Claus and Adrien,

Thanks for your quick responses.

Claus' comments made me realise my thought process about SimulateFrontEnd
functions was wrong. I mistakenly assumed that simulating a front end
before rendering my fluid partial would make my fluid links and images
automagically change their link and path generations.

I've chosen to write my own viewhelpers, based on this little gem:
http://blog.schreibersebastian.de/2011/11/frontend-links-im-backend-generieren/
So also a big thanks to Sebastian Schreiber for posting his solution.

For my links i have created my own viewhelpers based on Sebastians blog.
For my images i have subclassed f:image. In the fluid image viewhelper a /
is prepended to the image paths if the image path is being generated from
the back end. I simply added a forceFrontEndImageSrc param to the
viewhelper to ignore adding the / in front of the image paths if set to
TRUE.

Now i can pre generate all my (partial) templates and cache them in my
sheduler task, which will be another awesome performace boost.

Kind regards,
Tim

Hi Tim,

The best

On Aug 29, 2012, at 3:26 PM, typo3 at litedesigns.nl wrote:

> Am i taking the correct approach by using
> Tx_Fed_Service_Render->renderTemplateFile() or should i look in
> another direction? Any tips are welcome :)

Wether you use FED's RenderService or any other View implementation you
will have this problem, unfortunately.

Some suggestions:

Subclass f:image, f:link.*, f:uri.* etc. and use a parameter to force FE
link creation regardless of the TYPO3_MODE. Beware though, FE simulation
is not a nice thing to work with in Extbase.

Or replace the UriBuilder with one that allows forcing an FE context.

Or manually build the links (at least as much as possible).

This has come up a few times so far and to my knowledge there isn't a
really elegant solution to this FE/BE linking problem.

Hope this helps!

Cheers,
Claus


> Hey,
>
> You might be interested in yet another way to generate frontend links from
> any context (tested from 4.5 to 6.0).
>
> Have a look at the last two methods:
> https://github.com/Ecodev/newsletter/blob/1.3.0/Classes/Tools.php#L295
>
> Good luck,
>
> Adrien
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>



More information about the TYPO3-project-typo3v4mvc mailing list