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.
-
☆ 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.
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
I have done this with AJAX! If you PM/remind me I can share it when
I come home to my computer.
There is a clearcache function to use with your code to be found in the
old wiki.