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

CarpGroupFilter( feedlist );

Store local copies of a number of newsfeeds, and filter items out of it them
EvolutionLEKoiSE
>=3.5.6All>=3.5.6>=3.5.6
Description:
This function combines CarpCache and CarpFilter the same way that CarpCacheFilter does, but performs these functions for multiple feeds with one call. It also limits the number of feeds that are refetched at once in order to avoid unacceptably slow response times when many cache files have expired.

Arguments:
  1. feedlist: An array with RSS feed addresses as keys, and as values, either cache file names or arrays containing a cache file name and an encoding. The addresses may be URLs, paths to a local files, or data from a Grouper cache specified as "grouper:cache-name". Note that Grouper must be loaded before calling CarpGroupFilter if using the "grouper:" syntax. See the example below for details.

Return value: Up till version 3.6.2, none. Version 3.6.3 and later: returns a list of cache file names, suitable for passing to CarpAggregate or CarpInterleave (see example code below).

Usage Example:
<?php
// create a list of RSS feeds and cache file names, and optionally an encoding
$feeds=array(
	'http://www.geckotribe.com/press/rss/pr.rss'=>'gt-pr',
	'http://www.example.com/rss/feed1.rss'=>'ex-1',
	'http://www.example.com/rss/feed2.rss'=>'ex-2',
	'http://www.example.com/rss/feed3.rss'=>array('ex-3','ISO-8859-1'),
	'http://www.example.com/rss/feed4.rss'=>array('ex-4','US_ASCII'),
);
require_once '/home/geckotribe/carp/carp.php';
CarpConf('cborder','');
CarpConf('caorder','link');
CarpConf('maxgroupfilter',2);
CarpConf('filterin','Gecko Tribe');
$cachefiles=CarpGroupFilter($feeds);
CarpAggregate($cachefiles);
?>
For CaRP versions prior to 3.6.3, replace the last two lines with the following:
$cachefiles=CarpGroupFilter($feeds);
// extract a list of cache file names from the feed list created above
$cachefiles='';
foreach ($feeds as $v) {
	if (is_array($v)) list($v,$encoding)=$v;
	$cachefiles.="|$v";
}
// the list of cache files has an extra "|" on the beginning--use substr to remove it
CarpAggregate(substr($cachefiles,1));