We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 51315
    • 67 Posts
    I am building a picture gallery with getPage/getResources/Gallery snippets.
    The starting point is this post: https://forums.modx.com/thread/20187/how-to-use-modx-getresources-getpage-for-a-gallery-or-anything-you-want

    My menu is structured like this:

    Item 1
    - Subitem 1
    - Subitem 2
    - Subitem 3
    Item 2
    Item 3

    Subitems, which contain Gallery albums (straight images, no thumbnails) are actually hidden so do not appear on the menu.
    When You click, for instance, on Item 1, You get a page showing the first image from each Subitem with a clickable description that will get You to the corresponding full album.
    Like on a page aggregating news, where You can read an extract from each article/resource, but with images.
    Hope it is clear.

    So in my Item 1 resource I got:

    [[!getPage@Gallery?
        &element=`getResources`
        &parents=`5` THE ITEM 1 CONTAINER ID 
        &limit=`999`
        &tpl=`thumb_tpl_imageonly`
        &includeContent=`1`
        &sortby=`menuindex`
        &sortdir=`ASC`
    ]]


    Here is the thumb_tpl_imageonly chunk:

            <div id="block">
                <div id="pictures">
                    <a href="[[~[[+id]]]]"><img class="full-img" src="[[+image_absolute]]" alt="[[+description]]"></a>
                </div>
                <div id="description"><a href="[[~[[+id]]]]">[[+description]]</a></div>
            </div>


    And this is an example of Subitem page:

    [[!Gallery?
        &album=`AlbumOne`
        &imageQuality=`100`
        &sort=`name`
        &thumbTpl=`thumb_tpl_imageonly`
    ]]


    Almost everything works fine.
    The only problem I am encountering is that src="[[+image_absolute]]" Gallery property do not render anything.

    <img class="full-img" src="">


    Any suggestion? [ed. note: fredela last edited this post 10 years, 10 months ago.]
      • 51315
      • 67 Posts
      Let's put the question differently.

      Here is the tree:

      PICTURES
      > GALLERY1
      > GALLERY2
      > GALLERY3

      GALLERIES are hidden pages.
      Each GALLERY renders an album made with Gallery snippet.
      Now, what I want is PICTURES (parent) showing on click the first image from each GALLERY (child).
      So that visitors can click on each picture and be directed to the corresponding gallery.

      So I got this on my PICTURES page:

      [[!getPage?
          &element=`getResources`
      ]]


      But I am supposed to load and show the first image (with its description) from each gallery.

      So I tried something like this:

      [[!getPage@Gallery?
          &element=`getResources`
      ]]
      

      The question is:
      Does launching Gallery's property set allow me to use Gallery's properties like [[+image_absolute]] for retrieved images?
      Or it does not work because GALLERY page do not load Gallery snippet when requested by PICTURES page through getPage/getResources?
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        I'm pretty sure that the Gallery snippets themselves have the ability to do what you want without the use of getResources or any other listing snippets. At least that's how I did it once long ago, using a slick Javascript rotater to display the first items from each Gallery on the home page.
          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
          • 51315
          • 67 Posts
          Thank You, I will try to sort it out that way, too.
          By the way, what about using Gallery's properties set through getPage?
          Technically, do You think it could work?
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            It should work. getPage can work with any listing snippet, and the Gallery snippets are basically just listing snippet that list the albums and images.
              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
              Apparently there were some problems, I don't know if they were ever solved, but there is a discussion with a patch here. https://forums.modx.com/thread/37769/revolution-gallery---how-to-add-pagination
                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