Jump to:

10994 Posts in 2728 Topics by 1819 members

All other Modules

SilverStripe Forums » All other Modules » Editing layout on Image_Gallery module

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 1503 Views
  • sysyphus
    Community Member
    20 Posts

    Editing layout on Image_Gallery module Link to this post

    Hi I am working on the Image Gallery module on the following site: http://kidscostumes.co.nz/costumes/ I've edited it a wee bit to remove tops links to the various galleries. What I would like to do now is to have the gallery thumbnails to appear in two columns going down the page rather than one single column.

    I'm fairly new to silverstripe and only have a basic working knowledge of php so any help would be appreciated

  • divining
    Community Member
    3 Posts

    Re: Editing layout on Image_Gallery module Link to this post

    I will let you know as soon as I have finished with it myself, currently working on it.

  • UncleCheese
    4085 Posts

    Re: Editing layout on Image_Gallery module Link to this post

    Putting dynamic content into columns is a little prohibitive on the web because you need to have a way of closing the column in the middle of a loop. In the case of the gallery, you'll need to set your template up with a hard coded value of how many images go into each column. The downside is you'll have to make sure the images per page always remains the same in the CMS.

    First, you never alter the code of the module, so when updates come out you don't have to overwrite anything. So take image_gallery/templates/Layout/ImageGalleryPage_album.ss and copy the contents into /mysite/templates/Layout/ImageGalleryPage_album.ss. Run a ?flush=1 and the template is now yours to customize. Any template in your mysite or theme directory will always override its core counterpart.

    Let's assume you have images per page set to 10 in the CMS and you want two columns. The gallery items are displayed in a UL by default, which cannot be divided into columns because its only allowed children are LI tags, so you'll have to use two separate ULs.
    <ul class="left">
    <% control GalleryImages %>
    <% if Pos = 5 %></ul><ul class="right"><% end_if %>
    <% end_control %>

    As you see, we check for when the loop has executed 5 times and close the first list and begin the next.

    You can handle the markup any way you want, but that's the basic idea for the control.

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.