"New" Next to A New Listing

3 posts by 3 authors in: Forums > CMS Builder
Last Post: September 16, 2010   (RSS)

Re: [rentittoday] "New" Next to A New Listing

By Jason - September 16, 2010

Hi,

Yes, you can do this when you're outputting your records. You can use code like this:

<?php $curDate = strtotime(date("Y-m-d"));
$pastDate = date("Y-m-d",strtotime("-5 days",$curDate));
?>
<?php foreach($articleRecords as $record): ?>
<?php if($record['createdDate']>=$pastDate):?>
<span style="color:red;">NEW!</span>
<?php endif ?>


CMS Builder doesn't support a way to display this inside the backend.

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/

Re: [rentittoday] "New" Next to A New Listing

By Chris - September 16, 2010

Hi RIT,

CMS Builder keeps track of the date that records are created, so you can implement this with a little bit of PHP:

<?php if (time() - strtotime($record['createdDate']) < 60*60*24*5): ?>
<span style="color: red;">NEW</span>
<?php endif ?>


Note that 60*60*24*5 is the number of seconds in 5 days.

I hope this helps! Please let me know if you have any questions.
All the best,
Chris