We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22303 MODX Staff
    • 10,725 Posts
    You could have the code store it in $_SESSION on the same request it is created, but that would only be available to the user who created it. Or you could write to a shared file or database, storing the new document id for use in subsequent requests by anyone, until another one was created to replace it. Is this what you are asking?

      • 15065
      • 138 Posts
      I don’t know much about modx or maxigallery , so I couldn’t understand fully what you mean. My need is that ;
      I created a new document by calling a snippet from document . That snippet calls a .php page . In which new document created [ its code is mentioned above in this section as a reply from Ryan mentioned very basic method to create document, that is working fine for me and that was my need ]
      But after creating a new document, it doesn’t appear in the page menu. I want to appear the newly created page in my document menu.
      When I click on clear cache manually then I got the newly created page in menu. Is there any code that can be used in a snippet or chunk to site clear cache ? or There is any option to get the newly created page to my menu.

      If you give an answer in a step by step [ or in detail ] it would be very helpful for me.

      Thanks & Regards

      Jurdy
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Looks like you’ll need to clear the cache when you create the new document
        http://wiki.modxcms.com/index.php/API:clearCache

          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
          • 22303 MODX Staff
          • 10,725 Posts
          You’ll need to use the method seen in NewsPublisher. The API function mentioned simply removes cached pages; it does not rebuild the document map. However, even after doing so, you will not have access to the new map until the next request.
            • 15065
            • 138 Posts
            How can I call this in my snippet. I put $modx->clearCache(); in a snippet and called that snippet. But nothing happened .
              • 22303 MODX Staff
              • 10,725 Posts
              Quote from: jurdygeorge at Dec 22, 2007, 12:49 AM

              How can I call this in my snippet. I put $modx->clearCache(); in a snippet and called that snippet. But nothing happened .
              As I explained in the previous post, "the API function mentioned simply removes cached pages; it does not rebuild the document map. However, even after doing so, you will not have access to the new map until the next request." Please see the code for NewsPublisher for an example of how to call the cache functions you need to in order to rebuild the document map.
                • 15065
                • 138 Posts
                Thanks a lot for your help.
                Our client need one more thing.
                We have one page with maxigallery and managepicture button. Our client wants to add a new picture using managepicture button, at the same time they need one new document create. [ ie when they add new pictures, they want new documents create dynamically with the picture description as document alias. This is because, they need to create one category, and its subcategory, then its sub category etc. dynamically from front end.]
                Is there any provision to add new documents while adding new pictures using maxigallery manage picture button.
                If you can suggest a tool / or combination of snippets / any other ideas it would be very helpful...

                Thanks & Regards

                Jurdy
                  • 22303 MODX Staff
                  • 10,725 Posts
                  Nothing like that exists yet that I am aware of. Sounds like it would make some great additions to MaxiGallery though to have those features added.
                    • 15065
                    • 138 Posts
                    Thanks for your information

                    jurdy