Gossamer Forum
Home : Products : DBMan : Customization :

Displaying "NEW" beside new items.

Quote Reply
Displaying "NEW" beside new items.
I imagine the calculation would be simple, if placed in the correct place. When displaying items, if the date is less than 7(?) days old, allow for a new.gif or something to be placed by its db_key while view_records=1.

Has this been done?
Quote Reply
Re: Displaying "NEW" beside new items. In reply to
I haven't seen it done, but I think it probably could be.

Code:
$days = 7; # number of days to look for
$new = time() - ($days * 86400);
if ( &date_to_unix($rec{'Date'}) >= $new) {
print qq|<img src="http://URL/to/new.gif">|;
}

Completely untested, but I don't see why it wouldn't work.

This would go into html_record wherever you wanted to print out your "new" graphic. Be sure to close off any previous print qq| statements with a |; and to start a new one after the above code in order to print the rest of the details of your record.

Also, I'm just assuming that the field which holds the date the record was added is called "Date." If it isn't, change the fieldname that's in bold letters within the code.

Don't forget that field names are case-sensitive.


------------------
JPD