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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Themes /

Discuss SilverStripe Themes.

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

Bootstrap Gallery Template -> Every third picture in a new row


Go to End


2 Posts   3043 Views

Avatar
Holoch

Community Member, 17 Posts

23 December 2014 at 10:07am

Edited: 23/12/2014 11:49am

Hi all

II want to use this bootstrap gallery template
but I need to find out how to set the template, that every third image was a new line. end </div> and start new <div class = "row">

exemple :
<div class="row">
<div>
<img src="1.jpg" >
</div>
<div>
<img src="2.jpg" >
</div>
<div>
<img src="3.jpg" >
</div>
</div> <!-- end row for each third and start new one-->
<div class="row">
<div>
<img src = "4.jpg">
</div>
............
............
</div>

i try something like that <% if $Pos / 3 == 1 %> in ss template but notworking

Avatar
JonShutt

Community Member, 244 Posts

5 February 2015 at 3:26am

assume you're looping an object of images?

check this out for adding code every 3rd item...
http://doc.silverstripe.org/en/developer_guides/templates/syntax/#modulus-and-multipleof