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

Filtering Example

This code will only display items containing at least one of the words "fly", "buffalo" and "samurai" in the title or description:

<?php
require_once "/path/to/carp.php";

// display a bullet before each item
CarpConf('bi','&bull; ');

// set up filtering
CarpConf('filterin','fly|buffalo|samurai');

// show up to 3 items
CarpConf('maxitems',3);

// show up to 100 characters of the description
CarpConf('maxidesc',100);

// show the newsfeed
CarpCacheShow('http://antone.geckotribe.com/dreams/rss/antone.talk.1.rdf');
?>


This code will only display items not containing any of the words "fly", "buffalo" or "samurai" in the title or description:

<?php
require_once "/path/to/carp.php";
CarpConf('bi','&bull; ');
CarpConf('filterout','fly|buffalo|samurai');
CarpConf('maxitems',3);
CarpConf('maxidesc',100);
CarpShow("http://antone.geckotribe.com/dreams/rss/antone.talk.1.rdf", "dreams.example.filter.b");
?>


This code will display items containing "fly", "buffalo" or "samurai", but not "rope" in the title or description:

<?php
require_once "/path/to/carp.php";
CarpConf('bi','&bull; ');
CarpConf('filterin','fly|buffalo|samurai');
CarpConf('filterout','rope');
CarpConf('maxitems',3);
CarpConf('maxidesc',100);
CarpShow("http://antone.geckotribe.com/dreams/rss/antone.talk.1.rdf", "dreams.example.filter.c");
?>


This code will display items containing the word "fly" in the title, or "family" in the description, but not "extended" in either the title or description:

<?php
require_once "/path/to/carp.php";
CarpConf('bi','&bull; ');
CarpConf('filterin','title:fly|description:family');
CarpConf('filterout','extended');
CarpConf('maxitems',3);
CarpConf('maxidesc',100);
CarpShow("http://antone.geckotribe.com/dreams/rss/antone.talk.1.rdf", "dreams.example.filter.d");
?>