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
Getting Started: Free Download | Purchase | Install
Reference: Functions | Plugins | Themes | Full Index
Etc.: Display Formatting | Example Code | Affiliates
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:
- Enter the following command into your webpage after "require_once '/path/to/carp.php';":
CarpLoadPlugin('hoursago.php'); - 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';
- dodays: this option controls whether date stamps for items more than 24 hours old are displayed using CaRP's built-in date formatting (idateformat or cdateformat)
or using this plugin's "dayformat" and "daysformat" settings.
Possible settings are:
- 0 (zero -- the default): use CaRP's built-in date formatting.
- 1 (or any positive number): use "dayformat" and "daysformat".
- A negative number (CaRP version 3.6.4 or greater): items more than 24 hours old, but less than the specified number of days old use "dayformat" and "daysformat". Older items use CaRP's built-in date formatting. For example, if it is set to -7, datestamps for items 1 to 7 days old will display like "4 days old".
- minuteformat: a "printf" style format string that is used to display the datestamp for items one minute old. It may contain one format specifier (for example, %d) into which the number 1 will be substituted.
- minutesformat: a "printf" style format string that is used to display the datestamp for items less than an hour but not one minute old. It may contain one format specifier into which the number of minutes will be substituted.
- hourformat: a "printf" style format string that is used to display the datestamp for items one hour old. It may contain one format specifier (for example, %d) into which the number 1 will be substituted.
- hoursformat: a "printf" style format string that is used to display the datestamp for items less than a day but more than an hour old. It may contain one format specifier into which the number of hours will be substituted.
- dayformat: a "printf" style format string that is used to display the datestamp for items one day old if "dodays" is set to a non-zero number. It may contain one format specifier (for example, %d) into which the number 1 will be substituted.
- daysformat: a "printf" style format string that is used to display the datestamp for items more than an day old if "dodays" is set to a non-zero number. It may contain one format specifier into which the number of days will be substituted.
- showfuturedates (CaRP version 3.6.4 or greater): If 0, item datestamps that are in the future will not be displayed. If it is non-zero, future datestamps will be displayed.