<,parameters>]] Examples: displays the feed of the pmwiki pages with the defauft layout and number of lines: [[$RSS http://www.pmichaud.com/wiki/Pm/AllRecentChanges?action=rss]] displays the pmwiki feed in long layout and the top 5 lines [[$RSS http://www.pmichaud.com/wiki/Pm/AllRecentChanges?action=rss,long,5]] displays the pmwiki feed in short layout and all lines in the feed [[$RSS http://www.pmichaud.com/wiki/Pm/AllRecentChanges?action=rss,short,-1]] $Log: rssdisplay.php,v $ Revision 1.2 2004/01/12 07:42:06 pts00065 Added simple, long and marquee display types. */ $DoubleBrackets['/\[\[\$RSS *([^\]]*)\]\]/e']= " RSS('\$1') "; define('MAGPIE_CACHE_AGE', 60*60); define('MAGPIE_CACHE_DIR', 'cache'); define('MAGPIE_FETCH_TIME_OUT', 15); function RSS($regex) { global $action; $line=""; if ( $regex == '' ) { $line.="Empty parameter in \$RSS "; } else { $tokens=explode(",",$regex); $url =$tokens[0]; $what =$tokens[1]; $num_items=$tokens[2]; if ( $what == '' ) { $what='short'; } if ( $num_items == 0 ) { $num_items=10; } if ( $action && ( $action == 'rss' ) ) { # this is important #pmwiki processes DoubleBrackets in the rss module #recursion untill the server blows $line.= "RSS Feed : $url"; } else { include_once('./local/magpie/rss_fetch.inc'); $rss = fetch_rss($url); #if fetch_rss fails magpie will produce some error message # we won't handle a check here if ( $num_items > 0 ) { $items = array_slice($rss->items, 0, $num_items); } else { $items = $rss->items; } foreach ($items as $item) { $href = $item['link']; $title = $item['title']; $description = $item['description']; $link="[[$href $title]]"; if ( $what == 'short' ) { $line .= "
  • $link\n"; } if ( $what == 'long' ) { $line .= "$link
    \n"; $line .= $description . "
    "; } if ( $what == 'marquee' ) { $line .= "$link \n"; } } } } if ( $what == 'marquee' ) { $line="$line"; } $line="
    $line
    "; return $line; } ?>