We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37449
    • 57 Posts
    Is there a way to pass the ID of a gallery item (ie an image) to another resource to display?
    I have a parent "Gallery Home" resource that lists the albums, and I have worked out how to link the thumbnail to another resource to display all the thumbs in that album.

    Now I’d like to link those thumbnails to another resource where I can display (for example) the descrioption and any other info.

    Is there an equivilant to &albumRequestVar for items?

    Thanks in advance
    Daz
      formerly sumodaz on here!
      • 37449
      • 57 Posts
      OK, I think I have solved this, but would like some feedback smiley

      In my template for the gallery thumbnail images, I entered a variable called imageID into the href string:
      <div class="[[+cls]]">
          <a href="[[~[[~262]]?&imageID=`[[+id]]`]]" title="[[+name]]">
          	<img data-href="[[+thumbnail]]" class="[[+imgCls]]" alt="[[+name]]" width="130" height="92"/>
          </a>
        <div class="clear"></div>
        <h5>[[+name]]</h5>
      </div>
      

      (262 is the ID of my image-viewer resource)

      I then created a snippet called get_image_id:
      <?php
      echo $_GET['imageID'];
      


      And then in the image-viewer resource, I call the snippet to get the ID!
      [[!GalleryItem? &id=`[[get_image_id]]` &toPlaceholders=`1`]]
      


      This assumes the premise that the images are given a unique ID number as they are loaded (which it appears they do), and of course, makes sense.

      So, is this how other people have done/do this?


      Thanks
      Daz
        formerly sumodaz on here!