We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    This seems simple but I haven’t been able to pull it off.

    I put a random picture on the home page with this call:

    [[MaxiGallery? &gal_query_ids=`all` &query_level_limit=`5` &order_by=`random` &limit=`1` &pics_per_row=`1`]]

    It works great but I’d like it so when the user clicks on the picture, it takes him or her to the gallery with that picture rather than to the picture itself with previous and next links.


    Is this doable with a change to the snippet call or do I need to hack the MaxiGallery code?

    Bob


      Did I help you? Buy me a beer
      Get my Book: MODX:The Official Guide
      MODX info for everyone: http://bobsguides.com/modx.html
      My MODX Extras
      Bob's Guides is now hosted at A2 MODX Hosting
      • 7923
      • 4,213 Posts
      Do a custom pictureTpl that links to the gallery document and not in the picture


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 3749
        • 24,544 Posts
        Cool! The picture could be from any gallery. How can I make sure the pictureTpl specifies the right gallery?

        Bob
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 7923
          • 4,213 Posts
          [+maxigallery.picture.gal_id+] is the id for the gallery and the link would then be,

          <a href="[~[+maxigallery.picture.gal_id+]~]"><img ..../></a>


            "He can have a lollipop any time he wants to. That's what it means to be a programmer."
            • 3749
            • 24,544 Posts
            I’ve really been wrestling with this one.

            Here is the snippet call:
            [[MaxiGallery? &gal_query_ids=`all` &query_level_limit=`5` &order_by=`random` &limit=`1` &pics_per_row=`1` &display=`pictureview` &pictureTpl=`mgPicture`]]
            


            Here’s my mgPicture chunk:
            <div class="picturecontainer">
            <a href='[~[+maxigallery.picture.gal_id+]~]'><img id="maxImage" src="[(base_url)][+maxigallery.path_to_gal+][+maxigallery.picture.filename+]" alt="[+maxigallery.picture.title:htmlent+]" /></a>
            	<p id="maxTitle">[+maxigallery.picture.title:htmlent+]</p>
            	<p id="maxDescr">[+maxigallery.picture.descr:htmlent+]</p>
            </div>
            


            It seems no matter what I try, none of the maxigallery.picture variables are expanded in the output. base_url gets inserted properly and so does maxigallery.path_to_gal, but everything else is missing.

            BTW, if I leave out the display parameter, the mgPicture chunk never executes and the snippet works like it used to, putting up a thumb as a link to a larger version of that picture.

            I imagine I’m missing something obvious here.

            Bob

              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 7923
              • 4,213 Posts
              Remove the display parameter from the snippet call and use galleryPictureTpl to define the template. That’s the template for rendering individual picture in thumbnail view.


                "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                • 3749
                • 24,544 Posts
                Excellent!! grin

                That did it. Thanks doze for all your help. It’s working like a dream now.

                The only hassle I have left is a purple box border around the thumb/link. I’ll have to check the CSS.

                Here’s my code for those wanting to do something similar:

                Here’s the contents of the chunk galleryPictureTpl:
                <div class="picturecontainer">
                <a href="[~[+maxigallery.picture.gal_id+]~]"><img id="maxImage" src="[(base_url)][+maxigallery.path_to_gal+]tn_[+maxigallery.picture.filename+]" class="thumbnail" alt="[+maxigallery.picture.title:htmlent+]" /></a>
                	<p id="maxTitle">[+maxigallery.picture.title:htmlent+]</p>
                	<p id="maxDescr">[+maxigallery.picture.descr:htmlent+]</p>
                </div>
                


                Here’s the snippet call:

                [[MaxiGallery? &gal_query_ids=`all` &query_level_limit=`5` &order_by=`random` &limit=`1` &pics_per_row=`1` &max_thumb_size=`110`  &thumb_use_dropshadow=`1` &galleryPictureTpl=`mgPicture`]]
                



                Thanks again for your help and for creating such a great snippet

                Bob


                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                  • 4041
                  • 788 Posts
                  you could simply add a

                  border="0"
                  into the img src call and the border will be gone.... smiley

                  <img id="maxImage" src="[(base_url)][+maxigallery.path_to_gal+]tn_[+maxigallery.picture.filename+]" class="thumbnail" alt="[+maxigallery.picture.title:htmlent+]"  border="0"/>
                    xforum
                    http://frsbuilders.net (under construction) forum for evolution
                    • 3749
                    • 24,544 Posts
                    Done. Thanks.
                    I put it in the css file instead.
                    Bob
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting