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

Multiple Feeds on a Page Example

The following code will display two feeds on the same page with the same formatting. Notice how you only need to "require_once" once. Also notice that CaRP will display up to five items from each feed, not a total of five:

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

// only show the item link
CarpConf('iorder','link');

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

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

// don't say "Newsfeed display by by CaRP" after the newsfeeds
CarpConf('poweredby','');

// Show the first newsfeed
CarpCacheShow('http://rss.geckotribe.com/rss/0.rss');

// Leave some space betwwen the newsfeeds
echo '<p>';

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

The following code will display two feeds on the same page. The first will have a bullet before each item. The second has all of its settings reset to the defaults by calling the function CarpConfReset(), and then the maximum number of items to display set to 5. In such a simple example, you would usually just add a line like "CarpConf('bi',"");" to reset the one configuration setting that had been overridden, but CarpConfReset() can be useful when you've overridden a number of options for one feed and then wish to display another feed with significantly different formatting.

Note that it is a good idea to set up background refreshing when accessing many newsfeeds from the same page:

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

// same settings as the previous example
CarpConf('iorder','link');
CarpConf('bi','&bull; ');
CarpConf('poweredby','');
CarpCacheShow('http://rss.geckotribe.com/rss/0.rss');
echo '<p>';

// reset all settings to their defaults
CarpConfReset();

// make any desired changes again
CarpConf('iorder','link');
CarpConf('poweredby','');
CarpConf('maxitems',5);
CarpCacheShow('http://antone.geckotribe.com/dreams/rss/antone.talk.1.rss');
?>