Show "NEW" image next to new listings

7 posts by 5 authors in: Forums > CMS Builder
Last Post: January 20, 2010   (RSS)

I would like to display a small image showing "NEW" next to my most recent posts or those posts added within the last 7 days. It should be done automatically and once 7 days have passed since it was added, the "NEW" image should not be shown.

Note: All my listings should show in the Listings Page but only the new additions will have the "NEW" image next to it.

Thank you.

Re: [WEVOLUTIONS] Show "NEW" image next to new listings

By Kenny - January 17, 2010

Re: [sagentic] Show "NEW" image next to new listings

This is similar to what I want. However I have a date being manually inputted and I have a separate field for "date added". Please help me in getting the code to display a "new" image added to listings within the last 7 days. I do not want to use the created date stamp.

Re: [WEVOLUTIONS] Show "NEW" image next to new listings

By Dave - January 17, 2010

Hi WEVOLUTIONS,

Try the following:
- Replace 'date' with the name of your date field
- Replace 30 with the number of days you want "New" to appear for
- Replace NEW! with the <img> tag for your new image

<?php
$secondsOld = time() - strtotime($record['date']);
$daysOld = intval($secondsOld/60/60/24);
?>
Days old: <?php echo $daysOld ?><br/>

<?php if ($daysOld <= 30): ?> NEW! <?php endif ?>


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

Re: [Dave] Show "NEW" image next to new listings

Thank you very much. It works.

Re: [Dave] Show "NEW" image next to new listings

By Wolf-E - January 20, 2010

Hi Dave. We've got a client running the old listings Manager Realty software - works fine BTW - but i'm wondering if this code could be tuned to use on that software, so new property could show a 'Just In' image or similar? Not sure if this has been asked before about the old LM gear.

Cheers