"Latest in Gallery" - Is it possible to only show a number of new images from a set?

Permalink Browser Info Environment
I'm thinking about adding a "latest in gallery" block to my homepage, that only shows the 3 or 4 latest images from the main gallery file set.

Jordan, is this possible with a custom template or should I rather ditch this idea?

Type: Discussion
Status: New
gd42
View Replies: View Best Answer
jordanlev replied on at Permalink Best Answer Reply
jordanlev
This would be fairly simple to do with a custom template. Copy this file:
SITEROOT/packages/sortable_fancybox_gallery/blocks/sortable_fancybox_gallery/view.php

...to here:
SITEROOT/blocks/sortable_fancybox_gallery/view.php


Now edit that new copy of the file, and find this line of code (around line #10):
<?php  foreach ($images as $img): ?>

...and replace it with these lines:
<?php
$max = 4; //<--set this to the number of images you want to show
$i = 1;
foreach ($images as $img):
    if ($i > $max) {
        break;
    }
    $i++;
    ?>
gd42 replied on at Permalink Reply
gd42
Thank you!

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.