Jump to:

7940 Posts in 1543 Topics by 946 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Getting images in ImageGallery to appear in a templated page?

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 944 Views
  • Jacknife
    Avatar
    Community Member
    16 Posts

    Getting images in ImageGallery to appear in a templated page? Link to this post

    Hi all,

    I need to get the images that are displayed in the gallery to appear in the the normal templated page when a thumbnail is clicked. I have set the pop up to 'none' but that just displays the image and nothing else.

    Any ideas?

    Cheers

  • UncleCheese
    Avatar
    4085 Posts

    Re: Getting images in ImageGallery to appear in a templated page? Link to this post

    It's not really set up to do that, but you could do it pretty easily by subclassing it out. Some pseudo-code:

    class MyImageGalleryPage_Controller extends ImageGalleryPage_Controller
    {
    function image()
    {
    return $this->customise(array('Item' => DataObject::get_by_id("ImageGalleryItem",$this->urlParams['ID'])))->renderWith(array('MyImageGalleryPage_image','Page');
    }
    }

    MyImageGalleryPage_album.ss:

             <% control GalleryItems %>
                <li style="height:{$Top.ThumbnailSize}px;width:{$Top.ThumbnailSize}px;">
                      <a href="<% control Top %>$Link(image)<% end_control %>$ID"><img src="$ThumbnailURL" alt="$Title"/></a>
                </li>
             <% end_control %>

    MyImageGalleryPage_image.ss

    <% control Item %>
    $Image.SetWidth(500)
    $Caption
    <% end_control %>

    Something like that oughta work.

  • Jacknife
    Avatar
    Community Member
    16 Posts

    Re: Getting images in ImageGallery to appear in a templated page? Link to this post

    Thanks. Will have try with that.

    944 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.