CaRP Evolution Documentation
CaRP Evolution Documentation
twitter youtube linkedin google-plus
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 Age Format plugin in action

Age Format

Age Format is a plugin bundled with CaRP Evolution. It enables you to apply different formatting to individual newsfeed items based on their timestamps. For example, you might display the headline and full description for items less than an hour old, the headline and up to 200 characters of the description for items less than 6 hours old, and just the headlines of the rest. You can also vary fonts, colors, and other formatting for different items.
 
Installation:
To install Age Format, put ageformat.php into the "plugins" folder inside the folder containing carp.php. (If no plugins folder exists, create one.)
 
Use:
To use this plugin, do the following:
  1. Enter the following command into your webpage after "require_once '/path/to/carp.php';":
    CarpLoadPlugin('ageformat.php');
  2. Specify any formatting changes you wish to apply for later items as follows:
    AgeFormatConf(option name, array of settings);
    • option name is the same as for CarpConf. Most options related to the appearance of items can be modified using this plugin.
    • array of settings is an array of settings to be applied based on the age of the item. The key for each entry in the array is the number of minutes old that the item must be to use that setting. The value of each entry in the array is the setting as it would be used with CarpConf. If an item is newer than the time specified by the smallest number of minutes, the setting for the smallest number of minutes will be used.

Example:
<?php
require_once '/PATH/TO/carp/carp.php';
CarpLoadPlugin('ageformat.php');
AgeFormatConf('iorder',array(
	0=>'link,desc',
	360=>'link'
));
AgeFormatConf('maxidesc',array(
	0=>0,
	30=>500,
	60=>200
));
AgeFormatConf('bilink',array(
	0=>'',
	360=>'&bull; '
));
CarpCacheShow('http://example.com/feed.rss');
?>
This example does three things: