[TYPO3-english] Do not cache part of Fluid template. How to?

Viktor Livakivskyi invisible.kinder at gmail.com
Mon Nov 4 16:21:02 CET 2013

Hi, List.

Some time ago a feature request [1] was opened on Forge to allow enabling/disabling of cache for individual Fluid partials. Request was abandoned and closed. Okay, I can leave with this, but, please, explain me, how can I, i.e., output current logged in user's name and email in Fluid?

I've tried following:

1. Easy mode. Just pass them via assign. Fails, because TYPO3 page's cache stores complete page for whole "Registered" usergroup.

2. Normal mode. Extract dynamic parts to a partial and pass different arguments to it from within template (username, email, timestamp). Fails for same reason.

3. Hard mode. Create extension, plugin, controller and non-cacheable action. Call it via v:render.request [2]. No luck...

4. Nightmare mode. Same as item 3, but additionaly create:
lib.noCache = COA
lib.noCache.pageHeader = USER
lib.noCache.pageHeader {
	userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
	pluginName = Smitemplates
	extensionName = SmiTemplates
	controller = NoCache
	vendorName = Vendor
	action = pageHeader
	switchableControllerActions {
	  NoCache {
		1 = pageHeader

	settings =< plugin.tx_smitemplates.settings
	persistence =< plugin.tx_smitemplates.persistence
	view =< plugin.tx_smitemplates.view
	update =< plugin.tx_smitemplates.update

Call it in template, like:
<f:cObject typoscriptObjectPath="lib.noCache.pageHeader" />

And assign in controller:
$this->view->assign('user', $GLOBALS['TSFE']->fe_user->user);

But, as you may have noticed, it is too non-intuitive way. Moreover, if I need some variable, that available in template, how can I bypass it to this non-cacheable controller then?

Maybe, I dig into wrong way and someone else knows better solution?

[1]: http://forge.typo3.org/issues/43457
[2]: https://fedext.net/viewhelpers/vhs/master/Render/RequestViewHelper.html

More information about the TYPO3-english mailing list