[TYPO3-mvc] ViewHelper-Condition: Caching Mechanisms

Christian Essl essl at incert.at
Wed Nov 23 15:13:49 CET 2011


I am using a custom if-condition with FLUIDTEMPLATE to offer two different versions of a website. The code is based upon the if-ViewHelper and very simple:

public function render() {

    if(-various checks about the user agent etc. -)
    {
      return $this->renderThenChild();
    }
    else
    {
      return $this->renderElseChild();
    }
}
<custom:ifMobile>
    <f:then>
      <f:render partial="mobile" arguments="{_all}" />
    </f:then>
    <f:else>
      <f:render partial="desktop" arguments="{_all}" />
    </f:else>
  </custom:ifMobile >

Now, the problem is, that TYPO3 caches the website, without regarding my  if-condition: When I first visit the website with a desktop browser it will always show the desktop version and vice versa.

Normally, in an pibase-extension I would change the last parameter in the addPItoST43-function call. But how do I make a ViewHelper-Condition work correctly with the caching mechanisms?


More information about the TYPO3-project-typo3v4mvc mailing list