Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Getting images in ImageGallery to appear in a templated page?


Reply


3 Posts   999 Views

Avatar
Jacknife

Community Member, 16 Posts

2 July 2009 at 5:38am

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

:D

Avatar
UncleCheese

Forum Moderator, 4096 Posts

2 July 2009 at 6:17am

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.

Avatar
Jacknife

Community Member, 16 Posts

2 July 2009 at 7:01am

Thanks. Will have try with that.

:)