Jump to:

10930 Posts in 2613 Topics by 1810 members

All other Modules

SilverStripe Forums » All other Modules » Including gallery items in a different page template

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 1799 Views
  • bird
    Avatar
    Community Member
    9 Posts

    Including gallery items in a different page template Link to this post

    Hi!

    I would like to include gallery images / items from a specific gallery page in another page's template.
    Using something like: <% control Page(mygallerypage) %>$Content<% end_control %> doesen't work because this can only be used for the static content / text but not for the dynamic gallery images.

    How could I include those images in a different template anyway?

    Best regards
    bird

  • patjnr
    Avatar
    Community Member
    101 Posts

    Re: Including gallery items in a different page template Link to this post

    A you trying to add more than 1 gallery pages on you site or you only want to use the images. ???

  • bird
    Avatar
    Community Member
    9 Posts

    Re: Including gallery items in a different page template Link to this post

    I would like to call those images in another template.
    willr (my hero) gave me the code in the IRC channel. Maybe this might be helpful for other users, too:

    Calling gallery page items in another template:

    <% control Page(your_gallerypage) %>
    <% if GalleryItems %>
    <% control GalleryItems %>
    <a id="ViewLink-$ID" class="$JSLightWindow"<% if JSMedia %> rel="$JSMedia"<% end_if %> href="$ViewLink" title="$Title">
    <img src="$ThumbnailURL" alt="$Title"/>
    </a>
    <% end_control %>
    <% else %>
    No Images
    <% end_if %>
    <% end_control %>

    You have to check that all the corresponding JS and CSS files (e. g. for lightbox) are called correctly in you template.
    The only thing I'm struggling with so far is the multi language use of this feature...

  • Lamin Barrow
    Avatar
    Community Member
    21 Posts

    Re: Including gallery items in a different page template Link to this post

    Enter this code

    $RecentImagesGallery(10)   

    in any page template file. This will pull the latest 10 images from your image gallery.

  • Lamin Barrow
    Avatar
    Community Member
    21 Posts

    Re: Including gallery items in a different page template Link to this post

    Enter this code

    $RecentImagesGallery(10)   

    in any page template file. This will pull the latest 10 images from your image gallery.

    1799 Views
Page: 1
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.