Can I list latest post differently?

3 posts by 2 authors in: Forums > CMS Builder
Last Post: June 4, 2010   (RSS)

By (Deleted User) - June 4, 2010

Hello,

I have a multi list page which displays blog articles.

I would like the latest blog post to be displayed a little differently ie with a larger image and different details from the remaining list.

All the details will be pulled from the blog list.

Any ideas? Thanks Jono

Re: [jonoc73] Can I list latest post differently?

By Jason - June 4, 2010

Hi Jono,

What you can do is set a variable that get changed after the first posting. This way you can always tell if you're outputting the first record or not.

It would look something like this:

<?php $firstRecord=true; ?>
<?php foreach($blogRecords as $blog): ?>
<?php if($firstRecord):?>
<?php $firstRecord=false; ?>
*OUTPUT LATEST RECORD*
<?php else: ?>
*OUTPUT REGULAR RECORD*
<?php endif ?>

<?php endforeach?>


As long as you're returning the latest post as your first record, this will work.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/