We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19328
    • 433 Posts
    Hi guys, I've got a strange MIGX problem. I'm going crazy over this! I've got a getResources snippet call, and in the rowTpl I have a getImageList call to show the first image in a MIGX tv for each item. When using a chunk as template in getImageList, each row contains the MIGX data from the first item. When I use inline code as tpl, it does work as expected.

    1. Getresources snippet call
    [[!getResources? &parents=`62` &limit=`2` &tpl=`newsTpl` &showHidden=`1`]]


    2. chunk newsTpl
    This produces the right images:
    [[+pagetitle]] - [[!getImageList? &tvname=`image` &tpl=`@CODE:<img src="[[+image]]" alt="[[+alt]]" />` &limit=`1` &docid=`[[+id]]` ]]


    This produces the image from the first item, in every row:
    [[+pagetitle]] - [[!getImageList? &tvname=`image` &tpl=`newsImage` &limit=`1` &docid=`[[+id]]` ]]


    3. chunk newsImage
    <img src="[[+image]]" alt="[[+alt]]" />


    I feel like I'm missing something really obvious here... What could be the problem? I thought that by adding the docid this should work.
    Thanks for any help!
      • 19328
      • 433 Posts
      To answer my own question, it must have had something to do with caching.
      Started with a fresh mind today and got it to work by using this construction:

      [[!getImageList? &tvname=`image` &tpl=`newsImage`
      &limit=`1` &docid=`[[+id]]` &toPlaceholder=`imagelist` ]]
      
      [[!+imagelist:notempty=`[[!+imagelist]]`]]
      


      When I call the placeholder cached I get the wrong value, but doing it like this works. Problem solved smiley

      Edit: not solved completely after all, still had the wrong image when deleting the image from the second entry.
      Now added idx to the mix and this does seem to work:

      [[!getImageList? &tvname=`image` &tpl=`newsImage`
      &limit=`1` &docid=`[[+id]]` &toPlaceholder=`imagelist[[+idx]]` ]]
      
      [[!+imagelist[[+idx]]:notempty=`[[!+imagelist[[+idx]]]]`]]
      


      This way the placeholder is different for each getresources iteration and an older version can never come up. [ed. note: michelle84 last edited this post 11 years, 5 months ago.]
        • 4172
        • 5,888 Posts
        This produces the image from the first item, in every row:

        [[+pagetitle]] - [[!getImageList? &tvname=`image` &tpl=`newsImage` &limit=`1` &docid=`[[+id]]` ]]

        strange. This should work.
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 38323
          • 26 Posts
          Just ran into a similar problem.

          I'm using 'resource-specific mediasource and multifile-uploader with MIGX' (http://rtfm.modx.com/extras/revo/migx/migx.tutorials/migx.use-resource-specific-mediasource-and-multifile-uploader)

          When using getResources with a getImageList snipped call inside it's chunk, the [[+image]] uses the wrong resource id (allways the first one, like mentioned above).

          To solve this particular problem I changed the Media Source for the resourcealbum to:

          [[!migxResourceMediaPath? &pathTpl=`assets/resourceimages/{id}/`]]
          instead of
          [[migxResourceMediaPath? &pathTpl=`assets/resourceimages/{id}/`]]
            • 4172
            • 5,888 Posts
            you can also use
            &processTVs=`0`


            and generate the path to your image inside the chunk with:

            assets/resourceimages/[[+property.docid]]/[[+image]]
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 30491
              • 44 Posts
              Hi,

              I've been meddling with this issue the entire day! I wish I had simply checked the forums earlier!!

              Thanks for the help from vlijmscherp and Bruno17--I suppose Bruno17's method has superior performance since it doesn't rely on any sort of caching/processing of a separate snippet. Though mind you, it seems that to use Brunuo17's fix you have to make sure that your TV is not set to MIGX but instead to TV (or Config..that worked too).

              Thanks a lot
              peace
                • 28107
                • 230 Posts
                same here ..

                I have a pdoResources call like
                [[pdoResources?
                
                   &parents=`[[*id]]`
                   &limit=`99`
                   &includeTVs=`tv.test-migx-tag`
                   &processTVs=`1`
                
                   &tpl=`test.chunk.list`
                
                ]]


                That lists some resources with text image etc.
                That works.
                Inside that template test.chunk.list
                I call another chunk with the getImage-call.

                That gives me always the first migx values .

                If I put that getImage call directly into my test.chunk.list I get the correct values ....
                  CONIN Werbeagentur . Köln
                  http://www.conin.de
                  • 4172
                  • 5,888 Posts
                  you have used

                  &docid=`[[+id]]`


                  and you haven't any inputTVs which are or was assigned to your template?

                  [Edit]
                  how do you call that chunk?
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 28107
                    • 230 Posts
                    cached and uncached.
                    feels like MODX does not like nesting of chunks froma distinct level. smiley

                    order was
                    template
                    -> calls chunk for listed output
                    -->chunk calls pdoResources which uses
                    ---> chunk template with a placed chunk that
                    ---->calls the getImages which uses
                    -----> a template for output

                    :)
                      CONIN Werbeagentur . Köln
                      http://www.conin.de
                      • 4172
                      • 5,888 Posts
                      http://bobsguides.com/blog.html/2014/05/15/dont-be-a-nester/

                      The issue can be parsing-order, for example first cached, then uncached
                      So, if you have an unchached pdoResources-call, your getImageList-call inside your chunk should also be uncached
                      Not sure, if its working then.

                      The issue can also be the same footprint of MODX-tags within the same request.
                      MODX does parse a MODX-tag with the same footprint only once within one request and does reuse the parse-result

                      you can try to produce different footprints for each iteration of the nested chunk like

                      [[$yourChunk? &id=`[[+id]]`]]
                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!