L.S.,
I'm using mediawiki 1.6.3 and I've hooked in an RSS feed on page level. However, the feed icon (firefox) only shows when I do something with the page: Edit it e.g.
Does anyone know how can I change this behaviour?
Thanks in advance for your answers,
Hans Oesterholt-Dijkema
Code follows:
*************************************************************
<?php ######################################################### # Configure here ######################################################### $wgBlog_MaxRSSEntries=10; $wgBlog_RSS_Location="/feeds/rss"; $wgBlog_RSS_Prefix="http://sample.sa/rss/"; $wgBlog_RSS_Title_Prefix="Sample Intranet - "; $wgBlog_RSS_Prefix="/rss"; $wgBlog_HTTP="http://"; #########################################################
$wgExtensionFunctions[] = "wfBlogExtension";
$blogEntries=0; $blogRSSFile="NoFile"; $blogRSS_URL="";
function wfBlogExtension() { global $wgParser; global $wgHooks; $wgHooks['ArticleSave'][]='blogEntries'; $wgParser->setHook("blog-entry",'blogPEntry'); $wgHooks['ParserBeforeTidy'][]='blogRSSLink'; }
function blogPEntry($input,$argv,$parser) { global $blogEntries; $blogEntries+=1; return "<A NAME="$blogEntries"></A>"; }
function blogRSSLink(&$parser,&$text) { global $wgOut; global $blogRSS_URL; global $wgBlog_HTTP; global $wgBlog_RSS_Prefix; global $wgBlog_RSS_Location; global $_SERVER;
$mTitle=$parser->getTitle(); $title=blogTidyTitle($mTitle->mTextform); $host=$_SERVER['SERVER_NAME']; $filename="$wgBlog_RSS_Location/$title.rss"; if (file_exists($filename)) { $blogRSS_URL="$wgBlog_HTTP$host$wgBlog_RSS_Prefix/$title.rss"; $wgOut->addLink(array('rel' => 'alternate','type' => 'application/rss+xml', 'title' => "RSS 2.0", 'href' => "$blogRSS_URL")); } }
function blogTidyTitle($title) { return preg_replace("/[^a-zA-Z0-9]/","_",$title); }
function blogEntries(&$article,&$user,&$_text,&$summary,&$minoredit,&$watchthis,&$sectionanchor) { global $wgBlog_RSS_Location; global $wgBlog_HTTP; global $_SERVER;
$text=$_text; preg_match_all("|[{][{]blog[^}]+[}][}]|",$text,$blogs,PREG_SET_ORDER);
$count=0; if (count($blogs)>0) {
$mTitle=$article->getTitle(); $title=$mTitle->mTextform; $title=blogTidyTitle($title); $urlTitle=$mTitle->mUrlform; $fh=initRSS($title);
$request_uri=$_SERVER['REQUEST_URI']; //QUERY_STRING']; $vars=explode('?',$request_uri,2); $request=$vars[0]; $host=$_SERVER['SERVER_NAME'];
foreach($blogs as $blogentry) { $entry=$blogentry[0]; $vars=explode("|",$entry);
$header=""; $dt=""; $link=""; $text="";
foreach ($vars as $v) { $vv=explode("=",$v,2);
if ($vv[0]=="h") { $header=trim($vv[1]); } else if ($vv[0]=="d") { $dt=trim($vv[1]); } else if ($vv[0]=="t") { $text=trim($vv[1]); } else if ($vv[0]=="l") { $link=trim($vv[1]); } }
$count+=1;
blogEntry($fh,$header,$dt,"$wgBlog_HTTP$host$request/$urlTitle#$count"); }
endRSS($fh);
} return true; }
function blogEntry($fh,$header,$dt,$link) { $xml=" <item>\n". " <title>$header</title>\n". " <link>$link</link>\n". " <pubDate>$dt</pubDate>\n". " </item>\n";
fwrite($fh,$xml); }
function initRSS($mTitle) { global $wgBlog_RSS_Location; global $_SERVER; global $wgBlog_RSS_Title_Prefix; global $wgBlog_HTTP; global $wgBlog_RSS_Prefix; global $blogRSS_URL;
$host=$_SERVER['SERVER_NAME']; $dt=date("r");
$xml="<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n". "<rss version="2.0">\n". " <channel>\n". " <title>$wgBlog_RSS_Title_Prefix$mTitle</title>\n". " <link>http://$host</link>\n". " <lastBuildDate>$dt</lastBuildDate>\n". " <generator>MediaWiki Blog RSS Generator v0.1</generator>\n". "";
$blogRSSFile=fopen("$wgBlog_RSS_Location/$mTitle.rss","wt"); fwrite($blogRSSFile,$xml);
$blogRSS_URL="$wgBlog_HTTP$host$wgBlog_RSS_Prefix/$mTitle.rss";
return $blogRSSFile; }
function endRSS($blogRSSFile) { $xml=" </channel>\n". "</rss>\n". "";
fwrite($blogRSSFile,$xml); fclose($blogRSSFile); }
Hans Oesterholt wrote:
I'm using mediawiki 1.6.3 and I've hooked in an RSS feed on page level. However, the feed icon (firefox) only shows when I do something with the page: Edit it e.g.
Does anyone know how can I change this behaviour?
Cache.
-- brion vibber (brion @ pobox.com)
Sorry, could you be more specific about:
Cache.
?
Thanks in advance,
Hans
Brion Vibber schreef:
Hans Oesterholt wrote:
I'm using mediawiki 1.6.3 and I've hooked in an RSS feed on page level. However, the feed icon (firefox) only shows when I do something with the page: Edit it e.g.
Does anyone know how can I change this behaviour?
Cache.
-- brion vibber (brion @ pobox.com)
MediaWiki-l mailing list MediaWiki-l@Wikimedia.org http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
Delete your browser cache and reload your page.
2006/5/1, Hans Oesterholt semweb@elemental-programming.org:
Sorry, could you be more specific about:
Cache.
?
It all didn't work, I needed to add:
$wgEnableParserCache = false; $wgCachePages = false;
to LocalSettings.php.
--Hans
Armin Kniesel schreef:
Delete your browser cache and reload your page.
2006/5/1, Hans Oesterholt semweb@elemental-programming.org:
Sorry, could you be more specific about:
Cache.
?
MediaWiki-l mailing list MediaWiki-l@Wikimedia.org http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
mediawiki-l@lists.wikimedia.org