We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • This sounds interesting for sure.
      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. BlogTwitterLinkedInGitHub
      • 42141
      • 73 Posts
      I read the entry on Collections in the RTFM, but it isn't quite clear to me how to use Collections to set up a blog. And putting resources in collections, is that only in the backend or does it get populated to the front-end? That's also not quite clear to me.

      Is there more information on how to use collections to set up a blog?
        • 4172
        • 5,888 Posts
        Items in a Collections-Container are just Resources.
        To turn a Resource-Container into a Collections-Container, you need to change the Resource-type to 'Collection'

        Then, you have all Resources in a nice sortable and searchable grid instead of the Resource-Tree.
        Additional, you have different settings for fields in the update-page and columns in the grid.

        At Frontend, you just use getResources or pdoResources, to list your Items.
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 46580
          • 167 Posts
          What is the simplest way to migrate from Articles to Collections ?
          I tried to change "parent" ID in modx_site_content table : resource appears in "collection container" but the "articles" manager template Still in place...

          I don't know if I uninstall Articles extra if articles items will go back as document resources. [ed. note: johnxx last edited this post 8 years, 7 months ago.]
            MODX lover
            -
            Développeur MODX / Webdesign / Solutions web
          • I would work out a quickie SQL to set the Articles' resources parent and any other relevant fields WHERE parent = <id of parent Articles resource> and run that from phpMyAdmin or Sequel Pro or whatever your database access method is.

            You could get fancy and make a proper MODX function out of it using getCollection to get all of the Articles' children, the loop through them setting the values and saving them. Put the snippet on a resource, and View that resource to run the snippet. If you have a lot of them, use getIterator instead.

            It's been a while since I've worked with Articles, so you'll need to take a look at the database and see what settings are given to Articles' children and what settings are given to Collections children. I'm pretty sure that 'hidemenu' is set for Articles but not for Collections, you might want to change that to 0.
              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
              • 46580
              • 167 Posts
              Thank you very much for your reply, starting from this post http://forums.modx.com/thread/91922/is-collections-the-new-articles?page=2#dis-post-502464 I run :


              # switch ArticlesContainer -> CollectionContainer
              # the res. ID I want to migrate is 11
              
              UPDATE `modx_site_content` SET `class_key` = replace(class_key, 'ArticlesContainer', 'CollectionContainer') WHERE id=11;
              
              # switch class_key to go back to default document view for children
              
              UPDATE `modx_site_content` SET `class_key` = replace(class_key, 'Article', 'modDocument') WHERE parent=11;
              
              # Change template 49 -> 57
              
              UPDATE `modx_site_content` SET `template` = replace(template, '49', '57') WHERE parent=11;
              



              Quote from: sottwell at Sep 28, 2015, 04:17 PM
              I would work out a quickie SQL to set the Articles' resources parent and any other relevant fields WHERE parent = <id of="" parent="" articles="" resource=""> and run that from phpMyAdmin or Sequel Pro or whatever your database access method is.

              You could get fancy and make a proper MODX function out of it using getCollection to get all of the Articles' children, the loop through them setting the values and saving them. Put the snippet on a resource, and View that resource to run the snippet. If you have a lot of them, use getIterator instead.

              It's been a while since I've worked with Articles, so you'll need to take a look at the database and see what settings are given to Articles' children and what settings are given to Collections children. I'm pretty sure that 'hidemenu' is set for Articles but not for Collections, you might want to change that to 0.</id>
                MODX lover
                -
                Développeur MODX / Webdesign / Solutions web
                • 36624
                • 535 Posts
                Quote from: sophieschoice at Aug 02, 2015, 03:18 PM
                I read the entry on Collections in the RTFM, but it isn't quite clear to me how to use Collections to set up a blog. And putting resources in collections, is that only in the backend or does it get populated to the front-end? That's also not quite clear to me.

                Is there more information on how to use collections to set up a blog?

                the same here.. too much wp these days.. i thought just installing the extra will output the blog itself.. smiley

                dont forget to put in Collection Content field something like :

                [[pdoResources? &tpl=`blogTpl` &includeContent=`1`]]
                

                blogTpl
                <p><strong>[[+pagetitle]]</strong> —
                <em>on [[+createdon:strtotime:date=`%A, %B %e, %Y`]]</em></p>
                [[+content]]
                  CTRL+SHIFT+U - Clear Cache
                  CTRL+SHIFT+H - Hiding Heft Panel
                  CTRL+SHIFT+N - Fast Create Resource
                  CTRL+ALT+P - Preview Recource (in edit resorce window)
                  CTRL+ALT+S - Save