Tag Archives: mediawiki

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";

to

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

multilang breaks the NOSECTIONEDIT magic word

Facebooktwittergoogle_plusredditpinterestlinkedintumblrmailFacebooktwittergoogle_plusredditpinterestlinkedintumblrmail

Flattr this!

By Aka [Public domain], via Wikimedia Commons

MediaWiki Hacks

… today some minor MediaWiki Hacks:

Change the default Start Page

… there are two ways, depending on your settings in LocalSettings.php:

$wgUseDatabaseMessages = true

Go to MediaWiki:Mainpage and enter your new start page.

$wgUseDatabaseMessages = false

Add the following code to your LocalSettings.php file:

if (empty($_GET['title'])) $_REQUEST['title'] = 'NewStartPage';

… where NewStartPage points to your new start page.

Multi-Language Extension for MediaWiki

Extension:Multilang

Change your Sidebar

… again there ae two ways, depending on your settings in LocalSettings.php:

$wgUseDatabaseMessages = true

Go to MediaWiki:Sidebar and enter your changes.

$wgUseDatabaseMessages = false

Add your changes in Messages.php and all translation files (MessagesXX.php) you use.

Facebooktwittergoogle_plusredditpinterestlinkedintumblrmailFacebooktwittergoogle_plusredditpinterestlinkedintumblrmail

Flattr this!