We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 246
    • 3 Posts
    I’m working with a site that uses a custom page to add records to a custom database table. When a record is inserted into the custom table, a record in modx_site_content is also created. The problem is that right now I have to go back into the manager and make the site tree refresh before the page I created will actually be visible on the site (even though the record for it has been created in modx_site_content).

    Is there a simple method that’s part of $modx I’ve overlooked that would let me manually refresh the site tree? I couldn’t figure out how to do this on my own.
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      The resource tree is a javascript app, so unless it’s triggered to refresh via its AJAX restoreTree() function it can’t show the new resource.

      As far as the new resource being visible in cached menus and such, you’ll need to clear the cache when your new resource is successfully saved, just as the Manager resource editor page does.
        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
        • 246
        • 3 Posts
        So calling $modx->clearCache() should do it? I tried that and it doesn’t seem to be working... I’m still getting a 404 message when I try to visit the page listed in modx_site_content for the record I just added
          • 20413
          • 2,877 Posts
          I have done this with AJAX! If you PM/remind me I can share it when
          I come home to my computer. smiley

          There is a clearcache function to use with your code to be found in the
          old wiki.
            @hawproductions | http://mrhaw.com/

            Infograph: MODX Advanced Install in 7 steps:
            http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

            Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
            http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower