We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36315
    • 2 Posts
    I have a html file that gets updated every few minutes by a batch file. When i use a include i get current text. I would like
    the updated text be shown each time the page loads. I tried to use DynContent but end up in infinite loop.
    Any suggestions.

    Page1.html [ includes page2.html ]

    page2.html is updated by a shell script every few minutes .


    TIA
      • 3749
      • 24,544 Posts
      If you use an uncached snippet to include the dynamic content, it should update on every page load.

      Something like this might work (I’m assuming that the dynamic page is a disk file):

      Revolution:

      [[!GetDynamicContent]]


      Evolution:

      [!GetDynamicContent!]


      <?php
      /* GetDynamicContent snippet */
      
      return file_get_contents('path/to/html/file');


      If the file contains stuff that you don’t want to include (and it probably does), you’ll need to parse it to get just the part you want.
        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
        • 36315
        • 2 Posts
        Thank you. Where do i create the code snippet it. Do i just create a new module with this name.
          • 3749
          • 24,544 Posts
          Quote from: whizkid at Jun 08, 2011, 10:01 AM

          Thank you. Where do i create the code snippet it. Do i just create a new module with this name.

          Not a module, you create a *snippet* with that name.
            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