We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32678
    • 290 Posts
    I've read through several posts about calling getImageList with pdo/getResources but cannot get an output.

    On my homepage, I call a chunk containing a getImageList call using pdoResources. When I swap out the pdoResources call with the getImageList call, I get output. If I call the chunk used by getImageList &tpl directly from pdoResources, the html outputs (but not the MIGX placeholders). Hence, the issue seems to be between the pdoResources and getImageList calls.

    Here are the calls and related chunks:

    [[pdoResources?
      &parents=`0`
      &resources=`5` // resource 5 is on the same level as the homepage 
      &limit=`1`
      &tpl=`carousel`
    ]]


    [[!getImageList?
        &tvname=`projects`
        &tpl=`homeCarousel`
        &limit=`1`
        &where=`{"featuredNews":"yes"}` // filter results using the featuredNews tv, which is within the projects MIGX tv.
        &docid=`[[+id]]`
    ]]


    <div class="grid-6 carousel">
    	<img src="[[+projectImage]]">
    	<div class="carouselTout">
    		<p>[[+projectCaption]]</p>
    	</div><!--end carouselTout-->
    </div><!-- end carousel -->


    What am I missing here? I've tried the pdoResources call with &includeTVs, using a combo of the MIGX TV, and the TVs within, with no effect. I've tried filtering the output from pdoResources, vs. the getImageList call, and also not filtering at all just to see if that's the issue, with no effect.

    Additional questions:
    In pdoResources, the default for &limit is 0. Is 0==none, or is 0==unlimited? I assume the latter, since that's how getResources treats it.

    In the case of the latter, is it needed in this scenario where pdoResources calls getImageList? For example, if I want four results, in which call should &limit=`4` be used?

    In which call should results be filtered? As mentioned, I need to show only those where featuredNews==yes (I assume getImageList is the place, since pdoResources is simply calling the results of getImageList)?

    Similarly, I also assume &includeTVs isn't needed in the pdoResources call, since processing is done by getImageList. Correct?

    Thanks in advance - hopefully all of this isn't totally rudimentary and other folks can benefit from the answers!
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      I don't understand this structure. What is the relationship between your pdoResources snippet and the getImageList snippet? Why are you using a pdoResources snippet at all for this?
        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
        • 4172
        • 5,888 Posts
        If all what you want, is to get the images from resource 5,
        you can do just:

        [[getImageList?
            &tvname=`projects`
            &tpl=`homeCarousel`
            &where=`{"featuredNews":"yes"}` 
            &docid=`5`
        ]]


          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 32678
          • 290 Posts
          Sorry, let me elaborate. The MIGX TV is used to display projects ( each being a combo of text and image TVs) on a Projects page. The featuredProject option tv is used include featured projects in a carousel that rotates on the homepage, as well. That's the structure described here. I'm using pdoResources because multiple projects can be featured.

          This is also why I asked the questions about the use of filter and limit parameters.
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Then you would want the getImageList snippet to be in the pdoResources tpl.

            You might want to look at BobRay's ClassExtender extra. While MIGx is one of the must-have extras on every site I build, it's not always the best solution.
              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
              • 32678
              • 290 Posts
              Quote from: sottwell at Aug 28, 2014, 09:51 PM
              Then you would want the getImageList snippet to be in the pdoResources tpl.

              Yes, that's what I have, and it's why I posted in the first place smiley. The getImageList call is in the carousel chunk and this is the pdoResrouces tpl. getImageList in turn uses the homeCarousel chunk (yes, the naming convention is confusing). I'm trying to determine why I get no output. If the calls look OK, something else is going on, but I posted to determine whether the use of the limit and filter parameters is correct (among other things).


              Quote from: sottwell at Aug 28, 2014, 09:51 PM
              You might want to look at BobRay's ClassExtender extra. While MIGx is one of the must-have extras on every site I build, it's not always the best solution.
              I will - thanks for the tip!
                • 4172
                • 5,888 Posts
                1. I would put each project in its own resource and put the images for each project in a MIGX-TV

                2. You are calling pdoResource cached, but getImageList uncached with an cached [[+id]] - placeholder. This may cause your issue. Try calling getImageList uncached, too.

                3. Regarding the limit.
                If you want to limit the Resources, you would use &limit in your pdoResources - call
                If you want to limit the images, you would use &limit in the getImageList - call
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 32678
                  • 290 Posts
                  Quote from: Bruno17 at Aug 29, 2014, 12:00 AM
                  1. I would put each project in its own resource and put the images for each project in a MIGX-TV

                  Thanks for the response and clarification on the use of limit. I assume that I should filter from pdoResources, then?

                  Also, creating a new resource for each project is what I'm trying to avoid. That would make this way easier, but there's no need for those resources within the hierarchy of the site. From your comment, it sounds like this is a recommendation, though, and not a requirement, for the way I have things set up to work?
                    • 4172
                    • 5,888 Posts
                    If you have all projects in a MIGX - TV, then you don't need a pdoResources - call.
                    Just the getImageList-call to get them.

                    How many projects will that be?
                      -------------------------------

                      you can buy me a beer, if you like MIGX

                      http://webcmsolutions.de/migx.html

                      Thanks!
                      • 32678
                      • 290 Posts
                      Quote from: Bruno17 at Aug 29, 2014, 11:46 AM
                      If you have all projects in a MIGX - TV, then you don't need a pdoResources - call.
                      Just the getImageList-call to get them.

                      How many projects will that be?

                      OK, that's where I went astray. Number of projects is undetermined, but for the lifespan of this particular structure, fewer than 10.

                      Thanks