Grouper - Documentation
Getting Started: Free Download |
Purchase |
Install
Reference: Functions | Plugins | Themes
Etc.: Configure | Affiliates
Reference: Functions | Plugins | Themes
Etc.: Configure | Affiliates
Function Reference
GrouperConvert(URL [, cachefile [, showit]]);
Grouper >= 1.6
Fetches an data from the internet or a local cache file and processes and outputs it according to any settings you may have specified. If a cache file was specified, the PHP variable $grouperconf['mtime'] will contain the UNIX timestamp for the last time the cache was updated after this function is called. This function is for use with non-search sources (XML plugins, scraper plugins, etc.) For search sources, use GrouperSearch instead.
URL: The address of the document to be processed by Grouper. Beginning with Grouper 1.6, the name of a cache file may be specified by entering "grouper:cache-name".
cachefile: The filename of the cache file in which to store a copy of Grouper's output. If this argument is omitted, no cache file is used, and the data is re-retrieved every time. We recommend only doing this while working on the configuration (unless using GrouperCache to maintain a local copy of the data or using a local file as the data source). Once you have finalized your settings, you will see significantly faster performance by specifying a cache file.
showit: If you set this argument to 0, GrouperConvert will generate or update the specified cache file, but will not display any data.
Example: (convert an Atom 1.0 feed to RSS, cache the RSS data in a file named "cache.rss", and output the RSS data)
<?php
require_once '/YOUR/PATH/TO/grouper/grouper.php';
GrouperLoadPlugin('xml.php');
GrouperLoadPlugin('xml-atom-1.0.php');
GrouperConvert('http://example.com/feed.atom','cache.rss');
?>
Example: (convert an Atom 1.0 feed to RSS, cache the RSS data in a file named "cache.rss" -- then use CaRP to display it as HTML)
<html>
<head>
<title>This is the page title</title>
</head>
<body>
<?php
require_once '/YOUR/PATH/TO/grouper/grouper.php';
GrouperLoadPlugin('xml.php');
GrouperLoadPlugin('xml-atom-1.0.php');
GrouperConvert('http://example.com/feed.atom','cache.rss',0);
require_once '/YOUR/PATH/TO/carp/carp.php';
CarpShow('grouper:cache.rss');
?>
</body>
</html>
NOTE: For CaRP versions before 3.5.10, the CarpShow line must be as follows:
CarpShow('/YOUR/PATH/TO/grouper/rsscache/cache.rss');