We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20682
    • 31 Posts
    Because TV’s can accept the "@" bindings I was wondering if there was a way, as there is with a snippet, to keep the TV in a non-cache mode while the document is cached?

    I have an @eval TV that I would like to use, but I also want to be able to cache my document.

    Thanks everyone
    Sheri
      • 22303 MODX Staff
      • 10,725 Posts
      Quote from: muskokee at Jul 18, 2007, 08:00 PM

      Because TV’s can accept the "@" bindings I was wondering if there was a way, as there is with a snippet, to keep the TV in a non-cache mode while the document is cached?

      I have an @eval TV that I would like to use, but I also want to be able to cache my document.
      For now, I believe the only way to do so would be to embed the output in a non-cacheable snippet, e.g. write a quick snippet called tvWrapper that does this...
      <?php
      return "[*{$tvName}*]";
      ?>

      Then call your snippet...
      [!tvWrapper? &tvName=`foobar`!]


      Alternatively, you can just use the getTemplateVarOutput() function to get the value in a non-cacheable snippet. e.g. create snippet called tvOutput...
      <?php
      $tvOutputArray= $modx->getTemplateVarOutput(array ($tvName));
      return $tvOutputArray[$tvName];
      ?>

      Then call it like...
      [!tvOutput? &tvName=`foobar`!]



      In 0.9.7, you will be able to apply the non-cacheable token directly to all kinds of tags as described towards the middle of the roadmap.
        • 20682
        • 31 Posts
        Thank you once again OpenGeek!
          • 6726
          • 7,075 Posts
          Nice tip Jason grin !
          This one should go into the wiki...
            .: COO - Commerce Guys - Community Driven Innovation :.


            MODx est l&#39;outil id