We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38471
    • 6 Posts
    Is it possible to nest getResources calls and still use getPage?

    I'm about to set up a video section on my site, and to make it easier for my visitors to get to exactly what they need, I am uploading both full versions of the videos, and shorter bits of those videos in case they want to see just that part.

    Each video is stored using TVs in a Resource, and I'm arranging the resources as I want them in Manager. What I thought I'd do is make the shorter versions child Resources of the Resource that has the complete video, because that mimics how I want it to display.

    I was going to use Wayfinder so that complete videos would have indented "sub-video" links (these would all be block elements with a video thumbnail and a short description), but I want pagination, because there will eventually be a lot of videos. Wayfinder doesn't appear to work with getPage because it doesn't have an "offset" property. However, getPage only takes one Snippet name, so I don't think I can nest two getResources calls to get the child records.

    Will I have to get into the API or am I missing something relatively simple?

    Thanks,
    -mark
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      I would use a MIGx TV to list the sub-videos for each video resource. The MIGx getImageList snippet would be in the getResources tpl.
        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
        • 38471
        • 6 Posts
        Is that the only way?
          • 4172
          • 5,888 Posts
          Lot of ways. You can of course also nest a getResources-call in another getResources(getPage)-tpl
          I think you will need to give them different pageVarKey - properties.
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 38471
            • 6 Posts
            Okay, so it is possible to next a getResources call inside a template chunk. I just wanted to make sure before I spent hours trying to make it work. I was confused because I've only seen examples of calling getResources from getResources, and I know you don't have that kind of flexibility in the snippet call when you use getPage. Thanks, I'll hack on it for a bit and see what happens.