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

    I want to create a grid of content (testimonials) which don't have their own resource. They will be tagged and pulled into various resources.

    The only way I know how to use Migx is by applying it to a specific template and then entering the data into a specific resource, but hoe do I make my Migx grid generic outside of any resource which I can then pull into various templates?

    I've read a bit about migx db but don't understand the difference between Migx and Migx db?

    Confused!!!!
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      MIGX is a custom TV that stores its data as a JSON array string in the same database table as any other TV. That JSON string can get very big, especially if your MIGX TV contains fields that are themselves other MIGX TVs (nested TVs) and is awkward and slow to process for display on the front-end. It's also hard to search or sort the individual items. It's really only suitable for relatively small, simple lists of items that you want to display in much the same manner as you would display resource summaries using getResources, but don't want to use Resources as your data source.

      MIGXdb uses database tables for its data. You can use it to access existing tables, such as the site_content table if you are using resources for your data, for example a resource-based events calendar or a real-estate listing. Or you can create custom tables for your data.

      A CMP gives a custom Manager page for managing your MIGX data. Sometimes a TV is good, if the data is tied to a specific resource, such as a gallery-type TV that's only for a home page carousel heading where you want the images along with some text and maybe a link to go with each image. Other times, it's not really appropriate to use a resource's TV for your MIGX-based feature's management, so a CMP is a better choice. MIGXMultilang is a good example of this more advanced kind of MIGX application.

      At its most advanced, MIGX/MIGXdb can be used as a full-blown add-on management CMP, creating all of the schemas, classes and what-have-you that any self-respecting add-on should have.
        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
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        As far as your initial question goes, for your purpose it could go either way. If you use a MIGX TV on a resource, you can specify which resource to pull the values from in the getImageList snippet.

        However, a MIGXdb-based CMP would also be a good choice. It would have its own custom database table, and would be completely independent of any resource.

        It just depends on your usage. Will you have a lot of these? Will you want to do more manipulation of the data than simply listing them in the order in which they are in the TV grid? Then the custom table and CMP will work much better than having to work with the JSON string.
          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
          • 51020
          • 670 Posts
          Thanks Susan,

          There will be a lot of gallery images to set up, and a lot of subgalleries (it's for a hotel, so there will be a gallery for bedrooms, restaurant, grounds etc etc). But, once they are set up, they wont change structure, but images will be added quite often. Each image will just have a title and description. So do you think a CMP is the way to go on that?
          Also, to get all the existing data in (there are hundreds of images) i was thinking of using importX or something similar?

          thanks
          Andy
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Definitely a job for MIGXdb and a CMP. There was just recently a discussion on importing lots of images, I'll see if I can track down the references.

            If you have the budget for it, it would be worth-while to see if bruno17 can help you set it up.
              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
              • 51020
              • 670 Posts
              OK great thank you.
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                  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
                  • 51020
                  • 670 Posts
                  That's brilliant - I'll have a read - thank you!
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    The CMP would have code to list all images in the directory, all you need to do is add the text - which would have to be done in any case.
                      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
                      • 51020
                      • 670 Posts
                      Yes - I don't fancy that task!! The only problem is that as images are added automatically to the directory, I will need to remember to go in and manually add the text for each one - which means I guess I may as well add the image manually too while I'm at it to avoid missing any.