We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12410
    • 353 Posts
    Hi Guys,
    How do u turn off caching for snippets. I am using snippets to call php files and the cache is always showing the old version of the file on update. I end up having to clear the System cache each time.
    Is there another way to call templates apart from php embeds in snippets? I want to be able to work on files directly in Dreamweaver instead of editing in the control panel.
    Thanks

    Apache/2.2.11 (Unix) , php 5, mysql 5, modx rev 2.0.8
      • 9710
      • 24 Posts
      [[!snippet]] instead of [[snippet]]


      Is there another way to call templates apart from php embeds in snippets? I want to be able to work on files directly in Dreamweaver instead of editing in the control panel.
      Sry, I don’t know what you mean.
        • 33968
        • 863 Posts
        Php includes are fine - try using this one.

        Just make sure you are calling your include snippet uncached - [[!include? .... ]] - so it will fetch your fresh code on every load.

          • 12410
          • 353 Posts
          Thanks Guys

          This is working fine for me and no caching issues

          [[!include? &file=`templates/index.php`]]


          I hope it helps somebody else!

          Cheers
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Once your snippet code is final, you might want to remove the uncached tag and let it be cached to speed up page views.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 12410
              • 353 Posts
              Cool thanks!
                • 52257
                • 11 Posts
                Hi it does not really work for me

                chunk -

                [[!get_homepage? &file=`/customSnippets/homepage.php`]]


                get_homepage snippet

                <?php
                return include $modx->getOption('base_path').$file;

                it returns same content when I use different browse. (I did some browser check in /customSnippets/homepage.php file)
                any idea?

                thanks

                  • 3749
                  • 24,544 Posts
                  Could the data used by the file to create its output be coming from the cache?
                    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
                    • 52257
                    • 11 Posts
                    Quote from: BobRay at May 13, 2016, 02:19 PM
                    Could the data used by the file to create its output be coming from the cache?

                    I have no idea. how to make them to be un-cached?