We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 52464
    • 14 Posts
    Hi my friends... I'm a novice developer getting into Modx Revolution. I have a problem related to Mgix and getImageList

    I'm trying to make possible the upload of multiple pictures at once using Migx and a template variable which houses all the pics as a photo album.

    For this task, I'm following this tutorial: https://docs.modx.com/extras/revo/migx/migx.tutorials/migx.use-resource-specific-mediasource-and-multifile-uploader. It explains that you have to create a dynamic resource-specific media source and to create a MIGX TV with a given configuration.

    As an overview, I have a Project template which has these template variables:

    • projectName
    • projectDescription
    • photoAlbum (input: migx and configuration: photoAlbum - same as Tv name)


    The user can create mutliple Project resources that use the Project template, and they appear on the site using a getPage call, which is placed inside a container resource:
    [[!getPage? 
            &element=`getResources`
            &parents=`[[*id]]`
            &limit=`4`
            &tpl=`chunkProject`
            &includeContent=`1`
            &includeTVs=`1`
            &processTVs=`1`
            &sortby=`menuindex`
            &sortdir=`ASC`
        ]]
    

    All the projects are processed with the 'chunkProject' chunk. Inside this code, there is a getImageList call which takes all the pictures from the template variable 'photoAlbum' for every project (remember that this Tv has Migx as input type and is an album of photos):
    <div class="project">
                <h2>
                        [[+tv.projectName]]
                </h2>
                <p class="description">
                        [[+tv.projectDescription]]
                </p>
                <div class="slider-wrapper">
                        [[!getImageList? 
                              &tvname=`photoAlbum` 
                              &tpl=`@CODE:<img src="[[+image]]" />` 
                              &where=`{"published":"1"}`    
                        ]]
                </div>
    </div>
    

    When browsing the site, every thing renders fine except that the 'photoAlbum' outputs nothing. They should appear as a stack of img tags (they are shown as a slider using the 'SlidesJs' script - not related to Modx).

    Let me add some details that may be important:

    Inside the getImageList call, I placed [[+image]] to display the images one after the other. Is that fine in my case? I got that code from the tutorial. I didn't create any 'image' chunk but I guess it is contained within the photoAlbum Tv configuration.

    And finally:
    On the tutorial, there is a configuration for the photoAlbum Migx TV which is a text like this:
    {
    "formtabs":[
    {
    "MIGX_id":71,
    "caption":"Image",
    "print_before_tabs":"0",
    "fields":[
    {
    "field":"title",
    "caption":"Title",
    "MIGX_id":327,
    "pos":1
    },

    etc... After pasting the complete text using the Migx Manager (Migx tab) inside photoAlbum TV, some of the parameters (such as '71' in 'MIGX_id') get changed if I check later that configuration.

    Any help is greatly appreciated!!!
      • 52464
      • 14 Posts
      I found that the problem is that I'm nesting a getImageList call inside the chunk used for the getPage call.

      I tried to display a photoAlbum from a single Project and it works, but the problems arises when I try to display all the projects inside a Project container.

      If a describe the problem with simple words: I don't know how to perform a getImageList loop inside a getPage loop...

      So, how can I display the photoAlbum for every Project nested within a container of Projects?