We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10525
    • 247 Posts
    I developing static snippets in external php files. Setting Disable Global Cache Options (cache_disabled) to Yes didn't stop caching, changes to snippet calls in resources didn't appear until I cleared the cache, and I even got a php error message in a cache file for one of my static snippets.

    I eventually disabled every cache type in Settings, and changes seem to appear in the front end on a normal refresh, but there are still files appearing in the core/cache dir.

    Anyone else finding that cache_disabled doesn't work?
      • 40358
      • 40 Posts
      Have you disabled partial caching of resources too?
        • 10525
        • 247 Posts
        Yes, I have disabled that. Everything is set to 'No' except for Disable Global Cache Options and Empty Cache default.
          • 10525
          • 247 Posts
          Here's one that just popped up:

          Parse error: syntax error, unexpected '}' in /var/www/vhosts/mydomain.com/httpdocs/core/cache/includes/elements/modsnippet/13.include.cache.php on line 41

          Should this happen when all caching is disabled?
            • 3749
            • 24,544 Posts
            I seem to recall that totally disabling the cache has never worked well. I could be wrong.

            IIRC, static elements are stored in both the DB and the files. I think MODX uses the DB version, so changes to the files only come into play when you load the snippet in the Manager and then save it, or possibly when you clear the cache. If I'm right, you'd see the old version used even if caching were successfully turned off. I could be wrong about this too -- I've never explicitly tested it. wink

              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
              • 10525
              • 247 Posts
              Hmm, seems a bit flaky to me. I have never been very confident with the way MODX allows editing of a static resource from both the file itself and from within the manager. I have lost code before due to that by saving an open snippet after changes made directly to the file. The intuitive think to my mind would be use only the file, if that is what the UI implies you're doing. I do get changes to the files appearing in the front end even if I have not loaded (opened) the snippet in the manager.
                • 3749
                • 24,544 Posts
                I've also lost code and almost never use the static option.

                Without loading the snippet in the Manager, it may still be updated if you clear the cache, or the snippet is called uncached. I've never tested it.
                  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
                  • 42562
                  • 1,145 Posts
                  I utterly distrust the Static option myself using the Static option.
                  It should treat static (remote file) as an INCLUDE.
                  And therefore not provide a MODX-internal way of editing/saving/dirtying said element content field.

                  I have not only lost code, but my poor already withered wits.
                    TinymceWrapper: Complete back/frontend content solution.
                    Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
                    5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
                    • 3749
                    • 24,544 Posts
                    LOL. I quit using the static option when I completely lost three hours of work on a very difficult coding problem. It works fine if you never have a momentary lapse, but if you program a lot, there are certain actions (like saving) that you often do without thinking.
                      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
                      • 10525
                      • 247 Posts
                      Quote from: donshakespeare at Sep 26, 2017, 07:29 AM
                      I utterly distrust the Static option myself using the Static option.
                      It should treat static (remote file) as an INCLUDE.
                      And therefore not provide a MODX-internal way of editing/saving/dirtying said element content field.

                      I have not only lost code, but my poor already withered wits.

                      Using includes sounds like a very sensible solution, straightforward to implement and more intuitive for users. I have also wasted many hours editing in a code editor just to have colour coding, tabs and line numbers, then pasting into the MODX manager. Daft.

                      If there was the option of a better code editor in the manager for chunks and snippets (like in Plesk) that would reduce my need to use static files in the first place. Is that an option at present?