We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15734
    • 70 Posts
    Hi, I’ve search through the forms but have not found an solution to hopefully a simple problem. I have a 2 column layout in which I want to display a single random image from a gallery with it’s title and description. I have 2 divs in my modx template. In one I have placed this maxigallery call:

    [!MaxiGallery? &gal_query_ids=`5` &display=`pictureview` &order_by=`random` &limit=`1` &pictureTpl=`singlePicture` &manage_target=`5`!]


    In the target document I have placed this call in its content:

    [!MaxiGallery? &gal_query_ids=`5` &display=`pictureview` &order_by=`random` &limit=`1` &pictureTpl=`singlePicture` &manage_target=`5` &is_target=`1`!]


    The target document is not visible in the menu but when I preview it i see what I’d expect. In the 2 column document that I want the random image to display I get the "singlePicture" template output but it references docid 1 (its own id) so nothing shows up. Also in the manage_target document no manage button appears.

    As an aside when I use &display=`embedded` I do get the proper output in both document. Thumbnails with manage button...

    Any one have any idea what I’m doing wrong? Thanks in advance.
      • 7923
      • 4,213 Posts
      Didn’t quite understand how you have setup it.. would be better if you’d create a list how your documents are setup with their id’s and what you want to show in the documents and what calls you have used.. eg.

      root
      |-homepage ID1
      |-gallerypage ID2
      |-someotherpage ID3

      In ID1 page i have this call..

      And I’d like to see this and that on the page.

      In ID2 page i have this call..

      And I’d like to see this and that on the page....

      etc..

      BUT, what I gathered from your post is that you are using the pictureview display type. That type makes maxigallery automatically choose the first picture from the gallery pictures and view it in the "picture view mode" using &pictureTpl. In that mode, the manage pictures button is not rendered and that’s why you are not seeing it.

      Also, I got that in your gallery page (with ID 5) you also have &gal_query_ids parameter used and &manage_target parameter what targets to the same gallery document (ID 5), is that correct? If it’s like that, you can remove both of those parameters because manage_target is by default the current document where the snippet is called and &gal_query_ids parameter is meant to be used only when querying images from another galleries, not when "creating a gallery" on some document. But yeah.. I’m not sure I understood fully how you have set it up.

      What you can do thought to retrieve a single random picture from a gallery or from multiple galleries (and see manage pictures button) is to use the following call in any document other than the gallery document itself (ID 5):

      [!MaxiGallery? &gal_query_ids=`5` &order_by=`random` &limit=`1` &galleryPictureTpl=`singlePicture` &galleryOuterTpl=`singlePictureOuter` &manage_target=`5`!]

      and in the "singlePictureOuter" chunk have the following:
      [+maxigallery.managebutton+]
      <br/>
      [+maxigallery.pictures+]

      and in the "singlePicture" chunk have the following:
      <div>
      <a href="[+maxigallery.picture_link_url+]">
      	<img src="[(base_url)][+maxigallery.path_to_gal+][+maxigallery.picture.filename+]" title="[+maxigallery.picture.title:htmlent+] [+maxigallery.strings.click_to_zoom+]" alt="[+maxigallery.picture.title:htmlent+] [+maxigallery.strings.click_to_zoom+]" />
      </a>
      [+maxigallery.picture.title:isnot=``:then=`
      	<p>[+maxigallery.picture.title:htmlent+]</p>
      `+]
      [+maxigallery.picture.descr:isnot=``:then=`
      	<p>[+maxigallery.picture.descr:htmlent+]</p>
      `+]
      </div>

      And customize those templates to output it the way you want.


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 15734
        • 70 Posts
        Thanks Doze! Even though you had to guess at what I was looking for you nailed it. I guess I was just distracted by the pictureview parameter. I’ve got some tweaking to do but everything is on track.

        Thanks again.