Klausn
Klausn

Reputation: 55

How to use the ifAuthenticated view helper correctly in regards to TYPO3 cache?

When using the <f:security.ifAuthenticated> view helper to render content only if the user is logged in, that content sometimes shows up (correctly) and sometimes not, even if the user is logged in all the time.

I guess the reason must be the page get's cached so the view helper does not always get the right state for the user. Does that mean in order to use this view helper one has to disable the entire caching for the page?

Upvotes: 1

Views: 373

Answers (1)

Claus Due
Claus Due

Reputation: 4271

The right approach is to only ever use this ViewHelper in USER_INT context or on pages where cache is completely disabled (though that is not recommended).

Only when the template you render is not allowed to be cached by TYPO3 will the ViewHelper execute every time and give the right result.

Upvotes: 2

Related Questions