We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27117
    • 28 Posts
    Hi

    My problem: Everyday at a certain time, I have to create a resource in modx (let's call it a news page).

    Is there a way to tell modx to automatically create this resource for me so I don't have to go into the manager, duplicate existing resource, adjust title and save it?

    Thanks
      Modx 2.1.3, PHP 5.2
      • 9995
      • 1,613 Posts
      can't u use publish date?
        Evolution user, I like the back-end speed and simplicity smiley
        • 27708 MODX Staff
        • 2,502 Posts
        Can you describe what the page content is? Whats the purpose of this new document? This can be done with a plugin provided you have regular site traffic. Otherwise you're going to need to use a cron job and fire a plugin via the api.
          Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
          • 27117
          • 28 Posts
          @fourroses666 I can use publish date to put the resource online at a certain time but I still have to create the source manually and because that would be a everyday task not only for one document, I'am trying to automate this.

          @Jay Gilmore: The page content is just a iframe with a videofile and some text that describes the video. I also thought about a cron job but I don't know what php code to fire. Do you know if there is already a plugin for this kind of task?
            Modx 2.1.3, PHP 5.2
            • 32699 ☆ A M B ☆
            • 427 Posts
            Cron job using Curl or whatever to call a published page hidden from menus would be the simplest and most reliable, I would assume.
              Get your copy of MODX Revolution Building the Web Your Way http://www.sanitypress.com/books/modx-revolution-building-the-web-your-way.html

              Check out my MODX || xPDO resources here: http://www.shawnwilkerson.com
              • 32316
              • 387 Posts
              How does the video file and text get to the server?
              Perhaps this process can create a resource with the content at the same time with a publish date if needed.
                • 3749
                • 24,544 Posts
                Is it the same URL each time? If so, a snippet or plugin could check the editedon field against today's date and regenerate the page content if they don't match.


                ---------------------------------------------------------------------------------------------------------------
                PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
                MODx info for everyone: http://bobsguides.com/MODx.html
                  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
                  • 27117
                  • 28 Posts
                  @W.Shwawn Wilkerson: I also thought about a cron job but what I can't get is how to create or duplicate a resource. But as Jay Gilmore wrote, a plugin might be the solution.

                  @whistlemaker: The Video file lies on an other server and the text gets to the server via a form that the user fills out. The form data goes into a custom db.

                  @Bobray: I'm not shure if I understand you correctly. What URL do you mean?

                  My resource tree looks like this: home->shows->news. Inside news folder a resource should be generated each day (120101_news, 120102_news, 120103_news...)

                  But what I don't get is how to thell a snippet or a plugin that it should create or duplicate a existing resource.
                    Modx 2.1.3, PHP 5.2
                    • 32316
                    • 387 Posts
                    Seems to me that the 'user' filling out the form that sends the text data to the custom db could also trigger some code duplicating the resource.

                    As to the code needed maybe these links will help:
                    http://rtfm.modx.com/display/revolution20/Using+runProcessor

                    and
                    http://api.modx.com/revolution/2.2/db_core_model_modx_processors_resource_duplicate.class.html
                      • 3749
                      • 24,544 Posts
                      I meant are you regenerating the same page each time or is it a new page. If it's the same page, you could use the method I described.


                      ---------------------------------------------------------------------------------------------------------------
                      PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
                      MODx info for everyone: http://bobsguides.com/MODx.html
                        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