Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Image Gallery - Latest Images on HomePage?

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2 3
Go to End
Author Topic: 3871 Views
  • UncleCheese
    Avatar
    4085 Posts

    Re: Image Gallery - Latest Images on HomePage? Link to this post

    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.

  • boombox
    Avatar
    Community Member
    44 Posts

    Re: Image Gallery - Latest Images on HomePage? Link to this post

    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

  • redactuk
    Avatar
    Community Member
    115 Posts

    Re: Image Gallery - Latest Images on HomePage? Link to this post

    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?

  • UncleCheese
    Avatar
    4085 Posts

    Re: Image Gallery - Latest Images on HomePage? Link to this post

    This is bundled in as of a few revs ago.

    Just do:

    $RecentImagesGallery(8)

    on any page.

  • redactuk
    Avatar
    Community Member
    115 Posts

    Re: Image Gallery - Latest Images on HomePage? Link to this post

    Excellent! thank you

  • Bedane
    Avatar
    Community Member
    2 Posts

    Re: Image Gallery - Latest Images on HomePage? Link to this post

    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

  • Bedane
    Avatar
    Community Member
    2 Posts

    Re: Image Gallery - Latest Images on HomePage? Link to this post

    first post and it was a double post...

    3871 Views
Page: 1 2 3
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.