We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38593
    • 129 Posts
    This is probably a noob question but ...

    We have chunk whose name is controlled by a snippet and appears in our template thusly:
    [[$hmqte-[[!+dstn]]]]


    My question is if we don't want this to be cached (it changes for every visitor). Do we simply attach the no-cache "!" as in the example above or should it be applied to the !$hmqte variable or to both?

    The chunks are named hmqte-th, hmqte-ak, etc, with ak, th being the placeholder value outputted by a snippet.
      Pedalers Bicycle Tours my website forged with MODX
      vandergraaf-M static website generator for MODX
      • 3749
      • 24,544 Posts
      Cache control is a black art, IMO, but I think the way you have it above should work fine as long as the snippet that sets the +dstn placeholder is called uncached (!) and is placed above that tag in the template. The fresh value of the chunk name should be set before the chunk tag is processed. I could definitely be wrong, but it should be easy to find out.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 38593
        • 129 Posts
        I tried all three variations and they all worked. But since I am not versed in the black arts of cache control, I thought it might be best to ask and find out which might be the preferred method.

        But yes, the snippet is uncached and it is the very first thing in the template as it controls many different sections.

        Thanks
          Pedalers Bicycle Tours my website forged with MODX
          vandergraaf-M static website generator for MODX