Search code examples
phpwebminecraftmodx

MODx - Php code isn't updating


I recently have been using snippets to power a "server status" page for my MinecraftServers, and it was working fine for quite a while, however now for some reason the php code is not updating! (It became very clear when our servers went down, and sadly the server status snippets were not updating, and quite a few of our users were getting confused!)

If I could receive any help, that would be awesome-

Problem:

Php Snippets are not updating (Not even after 24 hours)

Desired Result:

Is there a way to make it update every 2-3 minutes when being used, however if no one goes to the page, not update it at all..?

Snippet Code: on PasteBin

MODx Version - Revolution 2.2.6-pl


Solution

  • This is most likely due to caching.

    Caching in Modx means that the system creates an individual file for each resource in your site. These files are built up by all the snippets, chunks and placeholders you may have in your template and elements being parsed.

    If you chose to cache these snippets or chunks, Modx will not call the code again, but just output the content that was generated the very first time the cache was created.

    These are cached:

    [[mySnippet]]
    [[$myChunk]]
    

    These are uncached:

    [[!mySnippet]]
    [[!$myChunk]]
    

    Please note that you want to use as much caching as possible, but the snippet you are describing (different output without removing the cache) would require uncached tags.