We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42046
    • 436 Posts
    Has anyone else tried out the new pdoResources replacement for getResources? http://bezumkin.ru/sections/components/1462/

    Just tried it out on a site and noticed a considerable speed boost. It seems somewhat limited compared to getResources, is still in beta but results are rather intriguing.
    • Doesn't look all that limited to me... http://store.simpledream.ru/packages/database/pdotools.html#tab=properties

      Unfortunately not reading Russian makes it difficult to know much about it. The latest changelog and the readme is very interesting, though.

      - Improved pdoTools::getChunk() function, that processing placeholders faster, than original modX::getChunk().
        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
        • 42046
        • 436 Posts
        My assumptions on "limited" were based on auto translations of the initial blog post, but looking at the link you posted and playing around with it further seems the limitations I thought were more of a lost in translation situation.

        Using it on pages which make several getResources calls with varying includeTVList's delivers an impressive real world speed boost. Maybe the core dev team should take a serious look at the code and talk to the developer.

        Conditional templates are still one thing that appears to be lacking unless I'm missing something. [ed. note: absent42 last edited this post 10 years, 9 months ago.]
          • 18608
          • 112 Posts
          The improvement I get from this snippet is impressive!

          I just tested it several times.

          I had a heavy snippet call with getResources. When I reset the cache the first run takes approx. 7.3 sec for the page to load.
          With pdoResources it's approx. 2.2 sec on first run.

          The only thing I changed in the snippet call was the element used in getPage. All other parameters where the same.
            Mathias Dannevang | Webdesigner at dannevang.org | Tweets @dannevang
          • I'm trying to use pdoUsers to generate an alphabetic list of users, using AJAX to run a pdoUsers snippet when a button is clicked. I don't seem to be able to figure out if it's even possible, or how to set the &where to be something like
            &where=`username LIKE '%A' OR username LIKE '%a'`


            <sigh> Maybe if I didn't get it backwards, and tried A% and a%...

            Well, that doesn't seem to make a difference. Odd...it only shows a few users that start with 'a', and throws in a few that don't for good measure.

            Ok, now I see what it's doing. It's just displaying unfiltered users, with a default limit set.

            Got it! Thanks to a post by romain, I tried this and it works!
            [[!pdoUsers? &tpl=`userListTpl` &where=`{"username:LIKE":"a%"}` &limit=`0`]]
            [ed. note: sottwell last edited this post 10 years, 6 months ago.]
              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
            • This is fun! Try this one out...
              &where=`{"username:REGEXP":"^[^A-Za-z]"}`

              Lists all usernames that start with non-alphabetic characters!

              Have to take care with the regular expressions, MODx does weird things if there's a double [[ or ]] in it. [ed. note: sottwell last edited this post 10 years, 6 months ago.]
                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
                • 3749
                • 24,544 Posts
                Susan, have you tried PhpStorm's regex search yet? It highlights the "finds" in the editor as you type the regex, so it's easy to set up some test code with things you do and don't want to find to make sure your regex does what you want. For regex search and replace, it also shows you all the replacements.
                  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
                • Bob, I'm doing good to be using PhpStorm for about half of my coding now, usually when I'm trying to track down where a variable or a method comes from.
                    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
                  • Would be fantastic if we can get this translated best as possible, or people who have used it write up some English documentation and we put something in to the official RTFM docs.
                      MODX Ambassador for Thailand. Managing Director at Monogon, a web design and development studio based in Bangkok, Thailand. - Follow me on Twitter.
                    • I've been offering to pay for translation of this and MiniShop2 documentation, but can't seem to get any interest.
                        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