We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30816
    • 26 Posts
    Hello,

    I had to write small php script to add new document to modx database. Because it was to difficult to use modx/manager for some of my users.
    My php function simply INSERT to database’s table new values (to table modx_site_content).

    When I’m entering manager I can see new documents but on the website they don’t exists.

    What should I do?
      • 4310
      • 2,310 Posts
      Did you set them to published & show in menu ?
        • 30816
        • 26 Posts
        Quote from: bunk58 at Feb 05, 2009, 11:57 AM

        Did you set them to published & show in menu ?

        yes it’s published.

        I don’t know how exactly work modx. I suppose that all documents are stored in a file 9cache file?), and when I add new entry to my database with my function this (cache file) is not changing.
          • 30816
          • 26 Posts
          nobody could help me?
            • 26903
            • 1,336 Posts
            AS test try turning caching off on some of those documents and saving them, MODx should go straight to the DB for them AFAIK
              Use MODx, or the cat gets it!
              • 33337
              • 3,975 Posts
              The best bet is to use the DocAPI or similar for this, (please search in repository for them). They allow you much more control and let you handle the cache as well.

              Typically you script should trigger the clear cache function of modx after creating the new docs.
                Zaigham R - MODX Professional | Skype | Email | Twitter

                Digging the interwebs for #MODX gems and bringing it to you. modx.link
                • 33337
                • 3,975 Posts
                  Zaigham R - MODX Professional | Skype | Email | Twitter

                  Digging the interwebs for #MODX gems and bringing it to you. modx.link
                  • 4971
                  • 964 Posts
                  I think it is going to be easier for you to use roles and permission + ManagerManager to make it easier for your
                  customers to create, edit and erase docs.

                  If you tie this with a modification of the main page of the manager, your users cannot cause a lot of harm to
                  the installation and you can make it as easy as a click in a link to create a new document.
                    Website: www.mercologia.com
                    MODX Revo Tutorials:  www.modxperience.com

                    MODX Professional Partner
                    • 3749
                    • 24,544 Posts
                    You might also take a look at the NewsPublisher snippet included in your install. It creates new documents in PHP code from user input but I suspect you could use some of its code.

                    Take a look, also, at the import html option in the Manager.

                      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
                      • 30816
                      • 26 Posts
                      almost solved

                      I created new document called "clearing cache" and special snippet.

                      <?php
                      // sychronise the cache
                      $basePath = $modx->getConfig('base_path');
                      include_once $basePath."manager/processors/cache_sync.class.processor.php";
                      $sync = new synccache();
                      $sync->setCachepath($basePath."assets/cache/");
                      $sync->setReport(false);
                      $sync->emptyCache();
                      ?>


                      so when I add new document using my php function then I have to open my clearing_cache.html which includes snippet call.

                      This snippet clears correctly cached files. Is it possible no to erase all cached files but only modyfiy siteCache.idx.php file?