We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44933
    • 17 Posts
    how to use getresources to retrieve content of articles in modx
      Thanks in advance

      Media System Team
      http://www.toggletime.net
      • 3749
      • 24,544 Posts
      Articles are basically Resources, so you do it the same way you would normally use getResources.

      http://rtfm.modx.com/extras/revo/getresources
        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
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        One gotcha - individual Articles are automatically set to "not show in menu", so you have to add the showHidden property to your getResources (or pdoResources) snippet.

        You know what would be nice? If these listing snippets had more than just binary showUnpublished, showHidden, etc properties. There have been any number of times when it would be useful to have these work three ways, show only published/visible items, show only unpublished/invisible items or show all items.
          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
          You could do that with getResources' &where property. You might be able to put the various 'where' JSON strings in aptly named chunks or TVs for future use (and those could be called cached, since they would never change). I think using chunks would be faster and easier.

          I believe that if the &where property is present, the unpublished and hidden resources are no longer excluded by default. I could be wrong.



          [ed. note: BobRay last edited this post 12 years, 9 months ago.]
            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
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Oh, yes, there's always a dozen different ways to do just about anything you might want to do in MODx, but it would just be convenient (as well as more logical) to have the showHidden and showUnpublished properties handle all three options - 0 for hide them, 1 for show only them, and 2 for show all.
              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
              • 42562
              • 1,145 Posts
              I ran into this problem today and thought to myself (after trying all the basic of the basics): surely there are more ways to skin an ant.

              I was working on a user page (with Articles extra) that was to show in one section "My Published Articles", and in the other "My Drafts."
              I looked high and low for something like &showPublished=`0/1`, I even dreamt that getResources had some Easter egg I might be the only one finding.

              I ended up with
              [[!getResources? &where=`{"createdby:=":[[!+modx.user.id]], "published:=":0}` &showUnpublished=`1` &showHidden=`1`]]

              Any one missing parameter ruins the lot. [ed. note: donshakespeare last edited this post 12 years, 9 months ago.]
                TinymceWrapper: Complete back/frontend content solution.
                Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
                5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
                • 32507
                • 142 Posts
                Hi,

                Does Articles require getResources xtra? I prefer using pdoTools, but articles pages seems to get broken without getResources extra? I don't have any getResources call in Articles resources, templates, chunks etc?
                  • 4172
                  • 5,888 Posts
                  articles uses getResources internally.

                  Many of us don't use articles anymore.
                  We use collections to organize articles and stuff like that.
                  That's much more flexible and you can use any listing-snippets, any commenting-extra ,any tagging-system and so on.
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 32507
                    • 142 Posts
                    Ok. I'll go that way too.

                    Thanks.
                      • 3749
                      • 24,544 Posts
                      pdoResources should work fine with Articles. There are a few subtle differences in the arguments that require adjustment if you're converting a getResources tag, though, especially when it comes to TVs. My guess is that was your problem.
                        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