We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 53066
    • 8 Posts
    Under Revo 2.5.7-pl, I want a php snippet opening a session to count page calls and return the actual time. It does so – but onkly the first time after it has been altered. Thereafter I receive the same time and pagecall number again and again, and thus I assume that I do not see my snippet at work, but rather ... something else. A cached version? In which cache? Browser, proxy, server, MODX?

    Reading around one finds various „how to“, but they all don’t work:

    * I have the <meta http-equiv="Cache-control" content="no-cache">.
    * somebody else said that the above meta is outdated and one needs this:
    <html manifest="cache.manifest"> and a corresponding,
    suiting cache.manifest file. So I have this as well
    (the .manifest file in the root directory of my site),
    noting that this is also somewhere called outdated/deptercated.
    * My snippet has
    $cm = $modx->getCacheManager();
    $cm->refresh();
    * In MODX system settings I set the various cache expiry times to short values such as 2 (seconds).

    Despite all the above I don’t get a proper time display and page call count. I made a similar observation for file upload through a form – working as expected only the first time after altering the snippet and then stuck to “old stuff” although I POST new input by my form. It is the same in all browsers and on various sites (hosted by the same provider) and from various computers. The only nice guy is my laptops localhost. He returns – without any of the above – the actual time and pagecall count as expected. Should I conclude from this that the proxies are the terrorists? And ?unrelated side information: browser shutdown does not terminate my session although the php documentation and w3schools says it should.

    In my error log, the last entry is – in time – not related to the above issue and gave me a PHP warning: json_encode(). Don’t know what that means.

    Any idea what this might be and how to get around it? Is it a MODX issue or s.th. else?

    Thanky for your time on this.

    Best regards

    Axel


      • 3749
      • 24,544 Posts
      Are you calling your snippet uncached (with the exclamation point)?

      [[!SnippetName]]
        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