By Aka [Public domain], via Wikimedia Commons

MediaWiki Hacks III

To integrate RSS feeds there are a couple extensions for MediaWiki. The most up to date extension seems to be GISWiki/RSS which uses Magpie RSS as back end to fetch the RSS feeds.

To enable blogger atom feeds some tweaks are necessary to match the different formats:

Find the comment “# Bild items” and enter the following lines into the following foreach loop:

if (isset($item['atom_content'])) {
 $item['description'] =& $item['atom_content'];
 $item['date_timestamp'] = parse_w3cdtf($item['published']);

Above the “# Bild items” comment there is another foreach loop. Place the following lines inside that loop right after the if statement:

if (isset($item['atom_content']) && $item['atom_content']) {
 $description = true; break;

Because we did not want to show the complete description, we added the following function to truncate the text:

function mTruncate($string, $length = 200, $etc = ' ...') {
 if ($length == 0) return '';
 $string = strip_tags($string);
 if (strlen($string) <= $length) return $string;       
 $length -= strlen($etc);       
 return substr(preg_replace('/s+?(S+)?$/', '',     
   substr($string, 0, $length+1)), 0, $length).$etc; 

To activate the truncate function we changed the following line:

if ($text) $output.="n$text";


if ($text) $output .= "n" . mTruncate($text);

multilang breaks the NOSECTIONEDIT magic word


Flattr this!

Leave a Reply

Your email address will not be published. Required fields are marked *