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

Image Gallery - Latest Images on HomePage?


Reply

23 Posts   3956 Views

Avatar
UncleCheese

22 August 2009 at 3:18am 4085 Posts

Wow, looks like "lt" is not a valid operator in SS. I could have sworn it was. I would try something like..

$items = $album->GalleryItems()
return $items->getRange(0,5);

A better way to do it is probably to extend the album class as I showed you in a previous post.

Avatar
boombox

24 August 2009 at 3:54pm Community Member, 44 Posts

Hi there
Thanks for this info
I have extended the Image Gallery Pages into a new Page Type (LatestGalleryAlbum & LatestGalleryPage) and incorporated the Latest Album / Images in the home page.
You can see it in action here http://buffaloclub.smpmedia.co.nz/

Cheers

Avatar
redactuk

14 September 2009 at 11:04am Community Member, 117 Posts

Just installed Image Gallery (r271) today and trying to get example for latest images on front page to work.

I've put this in the Page_Controller section of my top-level Page.php:

   public function LatestImages()
   {
      return DataObject::get("ImageGalleryItem", null, "Created DESC", null, 8);
   }

and this at the top of my local copy of ImageGalleryPage.ss, as I want latest 8 images from all galleries to appear on top-level gallery page:

            <ul id="gallery-list" class="gallery-layout loaded">
               <% control LatestImages %>
                  <li style="height:{$Top.ThumbnailSize}px;width:{$Top.ThumbnailSize}px;">
                     <a id="ViewLink-$ID" rel="$RelAttr" class="$ClassAttr" title="$Caption" href="$ViewLink"><img src="$ThumbnailURL" alt="$Title"/></a>
                  </li>
               <% end_control %>
            </ul>

now I'm getting 8 placeholders return it seems, but each html list item appears as:

<a id="ViewLink-10" class="" rel="" title="" href=""><img src="" alt="#10"/></a></li>

the fact I'm getting an id value back seems to tell me I'm getting close, but why no other attributes populated?

Avatar
UncleCheese

14 September 2009 at 12:49pm 4085 Posts

This is bundled in as of a few revs ago.

Just do:

$RecentImagesGallery(8)

on any page.

Avatar
redactuk

14 September 2009 at 11:37pm Community Member, 117 Posts

Excellent! thank you

Avatar
Bedane

8 July 2010 at 11:40pm Community Member, 2 Posts

I know it might seem like I'm bringing back a post from the dead. I read this and it was very relevant to what I'm doing right now.

currently I have a VansPage_album (child), and a VansHolder page (parent). What I'm trying to do is allow my VansHolder page, to display the first three images in the individual VansPage_album album's. Currently i have three vans to show, and $RecentImagesGallery, seems to only want to display the first van, whilst the other 2 vans controls just have that javascript loading animation.

any help would be appreciated.

and sorry if this has been said before, new to ss and did do a quick search with no results.

Cheers
Jack

Avatar
Bedane

8 July 2010 at 11:40pm (Last edited: 8 July 2010 11:40pm), Community Member, 2 Posts

first post and it was a double post...