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.

Template Questions /

How do you display Thumbnails in GalleryHolder?


Reply


2 Posts   1263 Views

Avatar
fostahgix

Community Member, 9 Posts

17 June 2009 at 9:06am

Edited: 17/06/2009 9:37am

Hey all,

I found a thread ( http://www.silverstripe.org/archive/show/126874#post126874 ) which talks about displaying thumbnails in GalleryHolder.php(displaying thumbs is easy in GalleryPage, however the issue is I cannot find the gallery items within the children control of the GalleryHolder.php).

Here is the example that is demonstrated in the other thread:

<% 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 %>

When i do this i'm not getting any data passed to my <% control CurrentGalleryItems %>. I did an <% if CurrentGalleryItems %> and it never returns true..am I missing something to send current gallery items?

Here is my current GalleryHolder.ss file

<% control Children %>
   <% control CurrentGalleryItems %>
      <img src="$ThumbnailURL" alt="$Title"/>
   <% end_control %>

         <div id="$URLSegment" class="articleHolder" style="">
            <div><a href="$URLSegment">$Title</a></div>
            <p class="articleCopy">$Content</p><% include GalleryPageContent %>
         </div>
         
<% end_control %>

However, CurrentGalleryItems is not returning any data even though if they gallery is working..am I missing something? Thanks!

Avatar
fostahgix

Community Member, 9 Posts

17 June 2009 at 9:49am

Well I found a way to get it working setting a limit

<% control GalleryItems(10) %>

instead of <% control CurrentGalleryItems %> and it works now! I'm not sure if this is the best way to list items from the gallery but it works! :)