Is there a way to calculate either the first or last thumbnail in a row, upon which a class name like class="first", etc. can be added to the template?
Reason is the current CSS applies any declared values to all thumbs and we require a custom class in order to override this (we have a set width and need to null any padding to either the first or last image).
Thanks,
Jim
you can use the placeholder [+maxigallery.picrownumber+] in your gallerypicturetpl for that together with the parameter &pics_per_row=`4`
Ok, thanks, will have to update the snippet code we’re using as that doesn’t seem to be supported in our version.
Jim
You can do odd / even / first / last with PHx like this
Create a snippet named "phx:firstodd" with this content:
$current = $output;
$total = $options;
if ($current == '1') {
$output = 'first ';
}
if ($current == $total) {
$output = 'last ';
}
if ($current & 1) {
$output .= 'odd';
} else {
$output .= 'even';
}
return $output;
Then in your galleryPictureTpl, use:
class="[+maxigallery.picrownumber:firstodd=`[+maxigallery.config.pics_per_row+]`+]"
That should create following classes to your thumbnails depending on their number in that row:
class="first odd"
class="odd"
class="even"
class="last odd/even" the odd/even on last one depends of course from the number of pics per row.
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
Thanks, is this snippet route a cleaner way or will the placeholder [+maxigallery.picrownumber+] still do the same thing?
Jim
If you look closely, I have also used the [+maxigallery.picrownumber+] placeholder.
What my example does is that it puts the odd/even/first/last classes automatic and you can use more general css. It doesn’t matter if some gallery has 2 pictures per row or 8 pictures per row. If you use the placeholder straight away, it just returns the number for the picture in that row. So if you had for example 6 pictures per row and wanted to style odd/even/first/last, in my example, you could use the classes:
.first
.last
.odd
.even
in your css. But if you use the placeholder as is, like: class="picture[+maxigallery.picrownumber+]", you’d need to use:
.picture1 <-is first and odd
.picture2 <-even
.picture3 <-odd
.picture4 <-even
.picture5 <-odd
.picture6 <-is last and even
And then if you create another gallery with just 3 pictures in the row, you cannot use the same css because you have "staticly" defined what number is the last one, so you would have to create other classes:
.otherpicture1 <-is first and odd
.otherpicture2 <-even
.otherpicture3 <-is last and odd
So by doing what’s in my example, you can use more general css classes and use the same classes for every number of pictures per row.
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
@Doze - all good and works like a dream, thanks!
You need v0.6 test version for this to work.
"He can have a lollipop any time he wants to. That's what it means to be a programmer."
Thanks, got that, will dig ...