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.

Archive

Our old forums are still available as a read-only archive.

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

Albums in Gallery


Go to End
Reply

30 Posts   5826 Views

Avatar
sonicparke

22 July 2008 at 10:38am 74 Posts

I seem to be having trouble finding the "easy" way to create albums in Gallery 0.2.2. Is there an easy way or will I have to create a new page type & so forth?

Avatar
Willr

22 July 2008 at 1:47pm Forum Moderator, 5511 Posts

The gallery does not support albums as far as Im aware but this would be an awesome feature if you can contribute! I think what most people do - or what ive done in the past is make a GalleryHolder.php which has GalleryPage - Albums and that galleryholder just lists all the albums etc..

Avatar
Carbon Crayon

14 November 2008 at 12:59pm (Last edited: 14 November 2008 12:59pm), Community Member, 598 Posts

Hi Willr

how do you create a GalleryHolder and get it to return the images from its galleryPage children?

I can't seem to figure out how to return a group of dataObjectSets to display in the template. I'm no SS pro so I may be approaching this in the wrong way; I'm pretty much using the same method as the LatestArticles function in tutorial 2 and calling CurrentGalleryItems for each of the child pages, but I can't figure out how to make a group or array of these dataObjectSets to return to the template?.....:S

Avatar
deejayh

15 November 2008 at 3:17am (Last edited: 20 November 2008 10:57pm), Community Member, 10 Posts

This would be a great addition to Gallery.

Aram, you seem to have the right idea, but with my simple capabilities I could not help you.

At the moment, I have a gallery HOLDING page, with various images, with each one linked directly to each album. Simple - but not ideal.

Regards,
Dave

Avatar
Carbon Crayon

15 November 2008 at 5:00am (Last edited: 15 November 2008 5:01am), Community Member, 598 Posts

ahhhh, I think maybe that's what willr meant too, he just lists links the the albums rather than displays any of the photos within them.

I can display the first page of images by hard coding the gallery names into the template doing the following
GalleryHolder.php

function getGalleryItems($gallery){
$galleryPage = DataObject::get_one("GalleryPage", "Title = $gallery");
return $galleryPage.CurrentGalleryItems();
}


GalleryHolder.ss

<% control getGalleryItems(gallery1) %>

themplate stuff

<% end control %>
<% control getGalleryItems(gallery2) %>

themplate stuff

<% end control %>
etc....

but thats as far as I've got and it's not great because it won't dynamically add child galleries to the holder and will break if you change the names of the existing galleries.......

does anyone know if it's even possible to make an array of dataObjectSets or to somehow return a group of them that the template can iterate over?

Avatar
Carbon Crayon

15 November 2008 at 1:08pm (Last edited: 15 November 2008 1:26pm), Community Member, 598 Posts

Ok, so this is actually really easy!

All you have to do to get the first page of pictures from each child gallery is put the following into GalleryHolder.ss

<% control children %>
<a href="$Link">$Title</a>
<% control CurrentGalleryItems %>

<!-- Template stuff, copied from GalleryPageContent.ss to display the images -->

<% end_control %>
<a href="$Link">go to gallery &gt;&gt;</a>
<% end_control %>

Thats it! You get a nice set of pictures from each child galleries first page and its title.

can't believe how complicated I had made this, didn't even need any extra controller code! (EDIT: you need to copy the init function from GalleryPage.php so it gets the lightbox code/css etc)

I guess it shows how much I've still got to learn and also how damn awsome SS is :D

Avatar
mhull

20 November 2008 at 8:28am Community Member, 79 Posts

How would you get the Gallery to display albums?

I tried following the instructions above by aram, but couldn't get it to work.
Do you have any more info? or could you make the files available?

Avatar
deejayh

20 November 2008 at 10:59pm Community Member, 10 Posts

Yep I tried without success.

Could you attach the files here Aram?

Dave

Go to Top