CaRP Evolution Box
Web This Site

CaRP: Caching RSS Parser - Documentation


CaRP Interactive FAQ
Getting Started: Free Download | Purchase | Install
Reference: Functions | Plugins | Themes | Full Index
Etc.: Display Formatting | Example Code | Affiliates

See the Hours Ago plugin in action

Hours Ago

Hours Ago is a plugin bundled with CaRP Evolution. It enables formatting of the channel and item datestamps in formats like "15 minutes ago", "3 hours ago", "5 days ago", etc.
 
Installation:
To install Hours Ago, put hoursago.php into the "plugins" folder inside the folder containing carp.php. (If no plugins folder exists, create one.) This is the default location of the plugin when CaRP Evolution is installed.
 
Use:
To use this plugin, do the following:
  1. Enter the following command into your webpage after "require_once '/path/to/carp.php';":
    CarpLoadPlugin('hoursago.php');
  2. Use the configuration settings listed below to control the plugin.

Example:
The following code will display all datestamps as relative dates (by default, items more than a day old use CaRP's built-in date format):
<?php
require_once '/my/path/to/carp/carp.php';
CarpLoadPlugin('hoursago.php');
$hoursagoconf['dodays']=1;
CarpCacheShow('http://example.com/rss/feed.rss');
?>
All numbers of minutes, hours or days are rounded down. CaRP's built-in bidate, aidate, bcdate and acdate configuration options apply in each case whether relative dates are being used or not. Note that if time zone differences result in incorrect age calculations, CaRP's timeoffset configuration option may be used to make corrections.

Configuration Options:
The following configuration options may be set using code like this:

$hoursagoconf['hourformat']='Posted %d hours ago';