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

typo3 at litedesigns.nl typo3 at litedesigns.nl
Wed Aug 29 15:26:08 CEST 2012


Hi List,

I'm currently working on my first extbase extension, quite complex, but
i'm starting to get the hang of it after a lot of trial and error. And
reading the mailinglists of course :)

I've implemented the custom caching framework to speed up the front end
which works wonderfully well. I've also extended
Tx_Fluid_ViewHelpers_RenderViewHelper to cache partial templates. This is
where my question comes in.

I'm writing a Scheduler task and i want to pre-generate my partial
templates so i can cache them at night when my Scheduler task will run.

With t3lib_div::makeInstance('Tx_Extbase_Object_ObjectManager') i can get
to the ObjectManager to get my repositories and my objects etc which i
need to feed to my templates. I'm using the Tx_Fed_Service_Render class to
render my partial templates with renderTemplateFile(). I can feed this
function my template and objects, but i somehow need to simulate the
FrontEnd from within my Scheduler task because the template rendered by
Tx_Fed_Service_Render contains the wrong (read backend) paths for images
and links.

I've tried several simulateFrontEnd functions which i googled, including
the Extbase Tx_Extbase_Utility_FrontendSimulator, but my partial is always
rendered with the backend paths and urls. My links look like
http://www.example.com/mod.php?M=tools_txschedulerM1&tx__[my_object]=1&tx__[action]=show&tx__[controller]=MyController

Does anyone know if it is possible to render my partial in my scheduler
task? This way i can reuse all template code which is used in the frontend
and if my partial templates would change someday, my schedular task which
pre generates their cached versions will automatically cache the correct
output next time it is run.

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

Kind regards,
Tim

ps. i'm using Typo3 4.7.3 and all the latest versions of Extbase, Fluid,
Fed, etc.



More information about the TYPO3-project-typo3v4mvc mailing list