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
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:
- Enter the following command into your webpage after "require_once '/path/to/carp.php';":
CarpLoadPlugin('ageformat.php'); - 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=>'• ' )); CarpCacheShow('http://example.com/feed.rss'); ?>This example does three things:
- Displays the link and description for items less than 6 hours (360 minutes) old, and only the link for older items.
- Displays the full description for items less than 30 minutes old, 500 characters of the description for items less than an hour (60 minutes) old, and 200 characters of the description for items more than an hour old.
- Displays a bullet character (•) before the headline links of any items more than 6 hours (360 minutes) old (those whose descriptions are not displayed because of the first setting).