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.

All other Modules /

Discuss all other Modules here.

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

ImageGallery


Go to End


3 Posts   1154 Views

Avatar
aTTi

Community Member, 19 Posts

7 March 2010 at 1:20am

Hey Guys!

I have a question about the Image Gallery and I was stuck in a conversion.
Theres an exercise which i can't solve.
There's only 4 Photos allowed per row, so if someone uploads 20 Photos in 1 Album it must see like:

(Photo)(Photo)(Photo)(Photo)<br>
(Photo)(Photo)(Photo)(Photo)<br>
(Photo)(Photo)(Photo)(Photo)<br>
(Photo)(Photo)(Photo)(Photo)<br>
(Photo)(Photo)(Photo)(Photo)<br>

How can i do this?

http://yfrog.com/jximagegalleryp

Sorry for my bad english

Best regards, aTTi

Avatar
bummzack

Community Member, 904 Posts

7 March 2010 at 2:12am

There are several solutions to this. Here are two simple ones:
1) CSS: Wrap all the Photos in a block (eg. a <div>) and set it's width to four times the width of a photo plus margin. Then apply float: left to the photos.

2) PHP: Write a function that checks if the current position is a multiple of four. Look here for a recipe: http://ssbits.com/manipulating-every-nth-item-in-a-control-loop/

Avatar
UncleCheese

Forum Moderator, 4102 Posts

7 March 2010 at 3:55am

Yeah, just change the width of ul#gallery_layout.