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 Group Date plugin in action

Group Date

Group Date is a plugin bundled with CaRP Evolution version 4.0 and higher. It enables you to group the items in a feed by date, displaying, for example, a date header and/or footer around each group.
 
Installation:
To install Group Date, put groupdate.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('groupdate.php');
  2. Specify any formatting settings you wish as follows:
    GroupDateConf(option name, value); option name can be any of the following:
    • before: Any HTML code or text to display before the date stamp at the beginning of any date group.
    • after: Any HTML code or text to display after the date stamp at the beginning of any date group.
    • beforefirst: The same as "before", but only used for the first date group. If empty, "before" will be used for all date groups.
    • afterfirst: The same as "after", but only used for the first date group. If empty, "after" will be used for all date groups.
    • format: A formatting string like the one used for CaRP's idateformat setting, used to control the output format of the datestamp.
    • iformat [CaRP >= 4.0.18] : A formatting string like the one used for CaRP's locale-aware iidateformat setting, used to control the output format of the datestamp. If this is blank (the default), the "format" setting is used instead.

Example:
The following code will put each date group into an indented DIV, with the date stamp unindented, and only displaying the time for each item. Notice how "beforefirst" does not include a closing DIV tag, but "before" does, and how "aitems" is used to append the closing DIV tag after the last date group:
require_once '/path/to/carp.php';
CarpLoadPlugin('groupdate.php');
GroupDateConf('beforefirst', '<h2>');
GroupDateConf('before', '</div><h2>');
GroupDateConf('after', '</h2><div style="margin-left:25px;">');
CarpConf('aitems', '</div>');
CarpConf('idateformat', 'g:ia');
CarpCacheShow('http://example.com/feed.rss');