TYPO3 - Howto disable cache for specific content element on a page?

为君一笑 提交于 2020-01-03 01:47:29

问题


Is it possible to disable the caching for one specific element on pages? I tried already the following typoscript, as described in this answer, but it is not working for me (TYPO3 v8):

tt_content.textmedia.20 = USER_INT

I am using ext:fluid_styled_content with custom CTypes. From my understanding the above typoscript should disable the caching for the content element "Text & Media" (just as an example).

My custom element reads live data from an API using a ViewHelper. But the ViewHelper is just called, when the element is not cached. Othervise the cached content will be shown.


回答1:


fluid_styled_content uses the FLUIDTEMPLATE content object instead of USER as it was in css_styled_content. FLUIDTEMPLATE has no "non-cached" variant. I believe there are some options to change the caching of that element, but I could not find anything on that in the documentation.

Alternatively you could wrap it in a COA_INT object, which would look like something like this:

tmp.textmedia < tt_content.textmedia
tt_content.textmedia >
tt_content.textmedia = COA_INT
tt_content.textmedia {
    10 < tmp.textmedia
    10 =< lib.contentElement
}

If you take a look in the typoscript object browser (Template module), before the change it should look something like this:

And after the change it should look like this:




回答2:


But this construction for ext:form not works

tmp.tt_content.form_formframework < tt_content.form_formframework
tt_content.form_formframework >
tt_content.form_formframework = COA_INT
tt_content.form_formframework {
    10 < tmp.tt_content.form_formframework
    10 =< lib.contentElement
}

tmp.tt_content.list.20.form_formframework < tt_content.list.20.form_formframework
tt_content.list.20.form_formframework >
tt_content.list.20.form_formframework = USER_INT
tt_content.list.20.form_formframework {
    10 < tt_content.list.20.form_formframework
    10 =< lib.contentElement
}

for ext:news not works

tmp.tt_content.list.20.news_pi1 < tt_content.list.20.news_pi1
tt_content.list.20.news_pi1 >
tt_content.list.20.news_pi1 = USER_INT
tt_content.list.20.news_pi1 {
    10 < tt_content.list.20.news_pi1
    10 =< lib.contentElement
}


来源:https://stackoverflow.com/questions/57505896/typo3-howto-disable-cache-for-specific-content-element-on-a-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!