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?
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
- Page 11(current)
- 2
- 3
- 4
- Next 10 entries
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..
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
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
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?
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 >></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
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?
Yep I tried without success.
Could you attach the files here Aram?
Dave
- Page 11(current)
- 2
- 3
- 4
- Next 10 entries