CMS Builder photo gallery - newest image first?

5 posts by 2 authors in: Forums > CMS Builder
Last Post: February 19, 2009   (RSS)

Hi, there.

I have a client's photo gallery that is updated using CMSB: http://www.carv.ca/galleryPage.php. Is there a way to set this up so the most recently added images appear first? At the moment the oldest images are shown at the top and the latest are at the bottom.

Thanks!
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net

Re: [NigelGordijk] CMS Builder photo gallery - newest image first?

By Dave - February 17, 2009

Hi Nigel,

You can reverse the order with array_reverse().

If your current code looks something like this:
<?php foreach ($record['uploads'] as $upload): ?>

Just add this code in red:
<?php foreach (array_reverse($record['uploads']) as $upload): ?>

Let me know if that works for you!
Dave Edis - Senior Developer
interactivetools.com

Re: [NigelGordijk] CMS Builder photo gallery - newest image first?

By Dave - February 18, 2009

Hi Nigel,

That's the original style of code we generated from earlier versions, but it's still very simular:

<?php foreach (array_reverse(getUploads($options['tableName'], 'content', $record['num'])) as $upload): ?>

Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] CMS Builder photo gallery - newest image first?

Perfect! Thanks, Dave.
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net