Extension talk:News

Error
My wiki is 1.8.2, and i get this error: Fatal error: Call to undefined method DatabaseMysql::tableNamesN in /home/mazeikiu/domains/ mazeikiai.projektas.in/public_html/w/extensions/News/NewsRenderer.php on line 157

Any can help me? Thanks --88.222.212.231 12:24, 16 February 2007 (UTC)


 * Sure, upgrade to 1.9 -- Duesentrieb 14:17, 16 February 2007 (UTC)

Hm, are I can fix it for 1.8.2? :/

Just copy the function "tableNamesN" from the file in SVN "includes/Database.php" and copy to your installation. Works for me (Mediawiki v1.8.2) Jean-Lou Dupont 19:31, 20 February 2007 (UTC)

Can't install correctly
I tried to add the following line at the end (and anywhere else for that matter) in the LocalSettings.php file: require_once( "$IP/extensions/News/News.php" );

But it doesn't work. It only ends up writing the line at the start of the webpage. Any idea what I'm doing wrong? -- Kirjapan 22:34, 21 February 2007 (UTC)


 * add the line before the closing ?>-tag so it should look like this:

this might and actually should help.

Inserting in a Template
I ran into a problem whilst using the extension through a template (MW v1.8.2); "UNIQ" tags were appearing on the page. How do I get around this problem? Jean-Lou Dupont 17:57, 28 February 2007 (UTC)


 * Works fine for me on 1.10. But the parser is a strange beast, there probably have been some duptle changes in its working since 1.8. But then, I never said it would work with 1.8 :o)
 * So, sorry, no: I don't know how to get around this. And i don't have a 1.8 around to reproduce it. If you come up with a solution, please post it here. -- Duesentrieb ⇌ 22:57, 28 February 2007 (UTC)

inserting tables
It seems that tables (or rather, table rows) inside the NEWS section are not supported - neither with wiki markup (including the "!" template workaround), nor with raw HTML. Can you confirm (or even fix) that? Also, since this extension uses iterations anyway, would it be possible to define alternating styles (e.g to highlight odd rows)? -- FND 09:12, 27 March 2007 (UTC)


 * According to Duesentrieb, this extension uses template syntax, so table rows should be possible. However, each row is parsed individually, and it will not recognize table-row markup, without knowing that there is a table around it - and it can't really know that.

Fix for MW < 1.10
(code below) Voila, the extension now works for MW < 1.10 (at least 1.8.2 and 1.9.3)
 * Basically, you don't need to grab (or clone) the parser object. Just keep using the parser object you acquired when the class was created.
 * The next trick is to use the nifty function 'recursiveTagParse'.

-- Jean-Lou Dupont 19:07, 29 March 2007 (UTC)


 * Huh - am I missing anything? I've been using this extension with MW v1.9.2 for a few days now, and it seems to work just fine!?
 * Have you tried putting two or more of those tags on 1 page? or using it through a template call? or using the template defined format? That would be where one starts to have problems with the original version. Jean-Lou Dupont 11:04, 1 April 2007 (UTC)

Interresting... can you please provide a diff/patch of your changes, so i can check them against the original more easily? -- Duesentrieb ⇌ 19:05, 1 April 2007 (UTC)

Code: <?php /** * News renderer for News extension. * * @package MediaWiki * @subpackage Extensions * @author Daniel Kinzler, brightbyte.de * @copyright Â© 2007 Daniel Kinzler * @licence GNU General Public Licence 2.0 or later */

if( !defined( 'MEDIAWIKI' ) ) { echo( "Not a valid entry point.\n" ); die( 1 ); }


 * 1) no need to include, rely on autoloader
 * 2) global $IP;
 * 3) require_once( "$IP/includes/RecentChange.php" );
 * 4) require_once( "$IP/includes/ChangeList.php" );

class NewsRenderer { var $parser; var $skin;

var $usetemplate; var $templatetext; var $templateparser; var $templateoptions;

var $changelist;

var $namespaces; var $categories; var $types;

var $nominor; var $noanon; var $nobot; var $notalk;

var $onlynew; var $onlypatrolled;

function __construct( $templatetext, $argv, &$parser ) { global $wgContLang, $wgUser;

$this->skin = $wgUser->getSkin; $this->parser = $parser; $this->templatetext = $templatetext;

if ( !is_null( $this->templatetext ) ) { $this->templatetext = trim( $this->templatetext ); if ( $this->templatetext == '' ) $this->templatetext = NULL; }

$this->usetemplate = !is_null( $this->templatetext ); $this->templateparser = NULL; $this->templateoptions = NULL; #$template = @$argv['template']; if ( $this->usetemplate ) {

/* JLD:changes here $this->templateparser = clone $parser; $this->templateparser->setOutputType( OT_HTML ); #$this->templatetitle = Title::newFromText( $template, NS_TEMPLATE ); #$templatetext = $templateparser->fetchTemplate( $templatetitle ); $this->templateoptions = new ParserOptions; #$templateoptions->setRemoveComments( true ); #$templateoptions->setMaxIncludeSize( self::MAX_INCLUDE_SIZE ); }		else { $this->changelist = new OldChangesList( $this->skin ); }		$this->limit = @$argv['limit']; if ( !$this->limit ) $this->limit = 10; else if ( $this->limit > 100 ) $this->limit = 100; $this->unique = @$argv['unique']; if ( $this->unique === 'false' || $this->unique === 'no' || $this->unique === '0' ) $this->unique = false;

$this->namespaces = @$argv['namespaces']; if ( !is_null( $this->namespaces ) ) { $this->namespaces = preg_split('!\s*(\|\s*)+!', trim( $this->namespaces ) ); foreach ($this->namespaces as $i => $ns) { $ns = $wgContLang->lc($ns); if ( $ns === '-' || $ns === '0' || $ns === 'main' || $ns === 'article' ) { $this->namespaces[$i] = 0; } else { $this->namespaces[$i] = Namespace::getCanonicalIndex( $ns ); if ( $this->namespaces[$i] === false || $this->namespaces[$i] === NULL ) $this->namespaces[$i] = $wgContLang->getNsIndex( $ns ); }				if ( $this->namespaces[$i] === false || $this->namespaces[$i] === NULL ) unset( $this->namespaces[$i] ); }		}		$this->categories = @$argv['categories']; if ( !is_null( $this->categories ) ) { $this->categories = preg_split('!\s*(\|\s*)+!', trim( $this->categories ) ); foreach ($this->categories as $i => $n) { $t = Title::makeTitleSafe(NS_CATEGORY, $n); $n = $t->getDBkey; $this->categories[$i] = $n; }		}		$this->nominor = @$argv['nominor']; if ( $this->nominor === 'false' || $this->nominor === 'no' || $this->nominor === '0' ) $this->nominor = false; $this->nobot = @$argv['nobot']; if ( $this->nobot === 'false' || $this->nobot === 'no' || $this->nobot === '0' ) $this->nobot = false; $this->noanon = @$argv['noanon']; if ( $this->noanon === 'false' || $this->noanon === 'no' || $this->noanon === '0' ) $this->noanon = false; $this->notalk = @$argv['notalk']; if ( $this->notalk === 'false' || $this->notalk === 'no' || $this->notalk === '0' ) $this->notalk = false; $this->onlypatrolled = @$argv['onlypatrolled']; if ( $this->onlypatrolled === 'false' || $this->onlypatrolled === 'no' || $this->onlypatrolled === '0' ) $this->onlypatrolled = false; $this->onlynew = @$argv['onlynew']; if ( $this->onlynew === 'false' || $this->onlynew === 'no' || $this->onlynew === '0' ) $this->onlynew = false; $this->types = array( RC_EDIT, RC_NEW ); /* this doesn't work right if ( $unique ) { $group[] = 'rc_namespace AND rc_title'; }		*/	}

function query( $dbr, $limit, $offset = 0 ) { list( $trecentchanges, $tpage, $tcategorylinks ) = $dbr->tableNamesN( 'recentchanges', 'page', 'categorylinks' ); $where = array; $group = array; $select = "$trecentchanges.*"; $sql = "SELECT $select FROM $trecentchanges "; if ( $this->categories ) { $sql .= " JOIN $tpage ON page_namespace = rc_namespace AND page_title = rc_title "; $sql .= " JOIN $tcategorylinks ON cl_from = page_id ";

$where[] = 'cl_to IN ( ' . $dbr->makeList( $this->categories ) . ' )'; $group[] = 'rc_id'; }		if ( $this->nominor ) $where[] = 'rc_minor = 0'; if ( $this->nobot ) $where[] = 'rc_bot = 0'; if ( $this->noanon ) $where[] = 'rc_user > 0'; if ( $this->onlypatrolled ) $where[] = 'rc_patrolled = 1'; if ( $this->onlynew ) $where[] = 'rc_new = 1'; if ( $this->namespaces ) $where[] = 'rc_namespace IN ( ' . $dbr->makeList( $this->namespaces ) . ' )'; else { if ( $this->notalk ) $where[] = 'MOD(rc_namespace, 2) = 0'; $where[] = 'rc_namespace >= 0'; #ignore virtual namespaces (logs, mostly) }		$where[] = 'rc_type IN ( ' . $dbr->makeList( $this->types ) . ' )'; if ( $where ) $sql .= ' WHERE ( ' . implode( ' ) AND ( ', $where ) . ' )'; if ( $group ) $sql .= ' GROUP BY '. implode( ' AND ', $group ); $sql .= ' ORDER BY rc_timestamp DESC '; $sql = $dbr->limitResult( $sql, $limit, $offset ); $res = $dbr->query( $sql, 'newsxFetchRows' ); return $res; }	# The callback function for converting the input text to HTML output function renderNews { global $wgTitle;

$this->parser->disableCache; $dbr = wfGetDB( DB_SLAVE ); $text = ''; if ( !$this->usetemplate ) $text .= $this->changelist->beginRecentChangesList;

$remaining = $this->limit; $offset = 0; $ignore = array; #collect stuff we already have, when in unique mode while ( $remaining > 0 ) { #chunk loop for programmatic filter $chunk = $this->unique ? $remaining * 2 : $remaining; $res = $this->query( $dbr, $chunk, $offset ); $offset += $chunk; $has = false; while ( ( $remaining > 0 ) && ( $row = $dbr->fetchObject($res) ) ) { $has = true; if ( $this->unique && $row->rc_namespace >= 0 ) { $k = $row->rc_namespace. ':' . $row->rc_title; if ( isset( $ignore[$k] ) ) continue; $ignore[$k] = true; }				$t = $this->renderRow( $row ); $text .= trim($t). "\n"; #FIXME: handle blank lines at the end sanely. Paragraphs may be desired, but not when using lists. $remaining -= 1; }			$dbr->freeResult( $res ); if ( !$has ) break; #empty result set, stop trying }		if ( $this->usetemplate ) { #it's wikitext, parse // JLD:changes here $html = $this->parser->recursiveTagParse( $text ); }		else { #it's already html $text .= $this->changelist->endRecentChangesList; $html = $text; }		return $html; }	function renderRow( $row ) { global $wgUser, $wgLang; $change = RecentChange::newFromRow( $row ); $change->counter = 0; //hack if ( !$this->usetemplate ) { #$pagelink = $this->skin->makeKnownLinkObj( $title ); $this->changelist->insertDateHeader($dummy, $row->rc_timestamp); #dummy call to suppress date headers $html = $this->changelist->recentChangesLine( $change );

return $html; }		else { $params = array;

$params['namespace'] = $row->rc_namespace; $params['title'] = $row->rc_title;

$title = $change->getTitle; $params['pagename'] = $title->getPrefixedText;

$params['minor'] = $row->rc_minor ? 'true' : ''; $params['bot'] = $row->rc_bot ? 'true' : ''; $params['patrolled'] = $row->rc_patrolled ? 'true' : ''; $params['anon'] = ( $row->rc_user <= 0 ) ? 'true' : ''; #TODO: perhaps use (rc_user == rc_ip) instead? That would take care of entries from importing. $params['new'] = ( $row->rc_type == RC_NEW ) ? 'true' : '';

$params['type'] = $row->rc_type; $params['user'] = $row->rc_user_text; $params['rawtime'] = $row->rc_timestamp; $params['time'] = $wgLang->time( $row->rc_timestamp, true, true ); $params['date'] = $wgLang->date( $row->rc_timestamp, true, true ); $params['timeanddate'] = $wgLang->timeanddate( $row->rc_timestamp, true, true );

$params['old_len'] = $row->rc_old_len; $params['new_len'] = $row->rc_new_len;

$params['old_rev'] = $row->rc_last_oldid; $params['new_rev'] = $row->rc_this_oldid;

$diffq = $change->diffLinkTrail( false ); $params['diff'] = $diffq ? $title->getFullURL( $diffq ) : '';

$permaq = "oldid=". $row->rc_this_oldid; $params['permalink'] = $permaq ? $title->getFullURL( $permaq ) : '';

$params['comment'] = str_replace( array( , '|', '\ ), array( '&#123;&#123;', '&#125;&#125;', '&#124;', '$#39;' ), wfEscapeWikiText( $row->rc_comment ) ); // JLD:changes here $text = $this->parser->replaceVariables( $this->templatetext, $params ); return $text; }	} }

?>

Images shown rather than linked
If an image makes it to the list then it will be displayed, rather than linked to. Is there a workaround?


 * by (User: at )

Also, how does one get tables to work for this? I tried something like this, but it didn't work. This is using mw 1.10.0


 * To take away the "magic" from links to images and categories, use a leading ":", i.e.  :  instead of  
 * To make a table, use something like this:

 |--   |    |(User:    |)
 * HTH -- Duesentrieb ⇌ 00:10, 25 May 2007 (UTC)

insert News From a RSS feed
Hi, i prove to insert Links from a rss feed, but it dosent work..

What must i do?

real easy fix for 1.11
MW 1.11 requires hooks to return values. wfNewsSkinTemplateOutputPageBeforeExec almost works; all you gotta do is pop a "return" into it. News.php line 113:
 * true;

to
 * return true;</tt>

--Alxndr 13:07, 11 September 2007 (UTC)

show categories
Got title, user etc. - how do I post categories as well?

Old argument format?
Hi,

I'm an error saying:

Parser::replaceVariables called using the old argument format

When using the following code: * (User:, )

I have version 1.9.


 * Are you sure? Because that error is triggered by the new preprocessor code in 1.12 - and there's no resolution yet, see blow. -- Duesentrieb ⇌ 09:03, 31 March 2008 (UTC)

Change all the variables in the php files that have &$var to $var

1.12.0 patch
I was trying to make a quick&dirty patch for this extension to work in MediaWiki 1.12.0. But I didn't find any sample code using the new-style parser-function replaceVariables. Is there any example available or is the issue with 1.12.0 quite more complex than this?

Thx --Matsch 21:15, 30 March 2008 (UTC)


 * After a quick chat with Tim Starling, who wrote the new Preprocessor code, it seems that a simple "replace variables" function does no longer exist. It would require an extra "dummy" implementation of PPFrame and PPNode, as far as I understand. I will not have time to look into it until May though. -- Duesentrieb ⇌ 09:02, 31 March 2008 (UTC)


 * Thanks for the info! Unfortunately, I believe I do not have the necessary experience with and understanding of MediaWiki, but I might have a look into it when I have some time. This News extension was one of the reasons for upgrading our old MediaWiki 1.6.something. Guess I'll have to wait. Thanks for your efforts though! -- Matsch 20:05, 2 April 2008 (UTC)


 * Find a quick&dirty patch for NewsRenderer.php on my page http://crazylinux.de/MediaWiki#Last_Updates_.28News.29. It will use the old Parser -- Jonathan 23:05, 14 April 2008 (UTC)
 * duh! thanks :) -- Duesentrieb ⇌ 08:43, 15 April 2008 (UTC)


 * Thx! Seems to work great so far (although I had problems applying your patch, cuz your diff is actually in the wrong direction. I never used patch before, though). -- Matsch 19:49, 15 April 2008 (UTC)


 * Thanks for your feedback. I optimized the patch and wrote some more documentation. Hope it's more clearer now :-) -- Jonathan 23:42, 15 April 2008 (UTC)
 * Could not get the patch to work. when patching i still get the message, that only 4of5 patches went through and even when i manuly apply the stuff taht ends up in the rejection file i get "Fatal error: Using $this when not in object context in /var/www/mediawiki/includes/Parser.php on line 563" when I add a newsfeed tag. any suggestions? --Jansch 13:14, 16 April 2008 (UTC)

A patch that makes it work with the new parser too is available at User:Duesentrieb/PPCustomFrame. This patch was created against 1.13alpha, but since the PP stuff didn't change much, I hape it applies to 1.12 cleanly too. PLease give feedback if it works fo you. -- Duesentrieb ⇌ 14:51, 26 June 2008 (UTC)

Problems with MW 1.13.0
If I add news tag I get empty page when adding news tag. In web servers error log there are PHP Fatal error: Call to protected method ChangesList::insertDateHeader from context 'NewsRenderer' in /News/NewsRenderer.php on line 494, referer: <url_begin>&action=edit. Do you know if this can be avoided somehow? Problem exists also with MW 1.13.1 --Maksi
 * I have heard about this one before, I'll look into it soon. I'm a bit surprised it didn't come up before, since I did test with 1.13 when it came out. Oh, well. Will poke at it next week. -- Duesentrieb ⇌ 10:38, 17 September 2008 (UTC)
 * No news regarding this?
 * mine is throwing the same error :( if i mark line 494 as commented, it runns --Vdite
 * I get new errors after commenting it --Maksi
 * Any news?--Maksi 06:48, 21 October 2008 (UTC)
 * Receiving exact same error with PHP 5.2.6 and MediaWiki 1.13.4. as of 16:57, 9 February 2009 (UTC)
 * Have the same problem: PHP 5.2.6, mw: 1.13.1 any news??? 21:07, 25 February 2009 (UTC)

Fix for MW 1.13.2
Im using Linux with PHP 5.02
 * The problem occurs because the methods in the MW Class ChangesList are Protected and hence cannot be accessed by a non related class.
 * The easiest way round it is to make the NewsRenderer class extend ChangesList; hence making the methods available. As it does not inherrit from any other classes; this shouldn't effect any other functionality.

Open the file NewsRenderer.php and edit line 25 to make it look like this
 * class NewsRenderer extends ChangesList{

Hope that works for you! --physcopanda 11:10, 22 November 2008 (GMT)
 * Thanks it helped me --Maksi
 * Me too

new images only
Hi, How I can get only new images? I supposed that the following code should help, but it doesn't.

<news limit="5" onlynew namespaces="6">

--Dnikitin 18:54, 20 December 2008 (UTC)
 * It seems, namespaces option does not work correctly. --Dnikitin 02:17, 22 December 2008 (UTC)


 * namespaces="image" worked for me --159.28.230.170 21:27, 10 February 2009 (UTC)
 * I've installed a snapshot of version r37522 of the News extension. And I have russian version of mediawiki 1.13.3. Neither namespaces="6" nor namespaces="image" nor namespaces="Изображение" doesn't work -- show empty page. --Dnikitin 14:59, 3 March 2009 (UTC)
 * changes of images are shown (if 'onlynew' is not present), but new created images are not. --Dnikitin 15:35, 3 March 2009 (UTC)
 * I've done the same using Dynamic Page List extension --Dnikitin 23:44, 4 March 2009 (UTC)

Playing with NamespacePermissions
News doesn't play nice with Extension:Namespacepermissions. It completely ignores that pages are "protected". It would be nice if it checked for that and they could play together.

uses relative URLs
I am trying to process my feed with Yahoo Pipes. However, the issue is that utilizes relative URLs rather than absolute URLs. According to the W3C Feed Validation Service, it is strongly recommended that relative URLs not be used. What is the possibility of being parsed with absolute URLs?

Thanks for your great extension. --70.91.187.57 19:39, 11 March 2009 (UTC)

Error while importing large xml dump
The one wiki I am looking at, produces the following error with r50301 revision (latest to the current date) of Extension:News PHP Fatal error: Call to a member function getFullUrl on a non-object in E:\www\wikisite\extensions\News\NewsRenderer.php on line 589 The quick fix I've made to be able to finish the dump importing successfully is to put the following from the line 621 of NewsRenderer.php: if ( !is_object( $title ) ) { return ''; } It might not be the best approach, just I want to point out to the error. QuestPC 08:43, 13 May 2009 (UTC)

Suggestion for new option: "onlyold"
Suggest to include the option: "onlyold".

For use: Code, using diff (trunk-r54777): 50a51 > 	var $onlyold; 204a206,209 > > 		$this->onlyold = @$argv['onlyold']; > 		if ( $this->onlynew || $this->onlyold === 'false' || $this->onlyold === 'no' || $this->onlyold === '0' ) > 			$this->onlyold = false; 232a238 > 			$this->onlyold. ',' . 258a265 > 		elseif ( $this->onlyold ) $where[] = 'rc_new = 0';

Thanks, --Alexandre Porto 14:32, 24 August 2009 (UTC)

Undefined Variable
Hey! Iam using MW 1.15.0 and have a problem when i want to create a feed item. My syntax is: <newsfeed limit="5" nominor onlynew="true" namespaces="News">

It gaves me correctly the News in my box, but on top of my page, there are a notice:

Notice: Undefined variable: permaq in /var/www/web72/html/scooterpedia/extensions/News/NewsRenderer.php on line 456

When i click on my RSS button in MW or at the address bar, i could download index.php, but i dont see any rss feed.

I hope you can help me!

Ignoring Redirects with onlynew
Special:NewPages seems to be ignoring pages with redirects. Is there a way to achieve the same behavior with newsfeed? Currently I'm using <newsfeed limit="20" trigger="" onlynew namespaces="main" /> Thx -- Matsch 09:57, 11 November 2009 (UTC)

Broken on 1.16
This extension does not work on MW 1.16 --Alterego 20:29, 7 January 2010 (UTC)
 * Is there any news on this?--72.28.72.1 16:00, 1 October 2010 (UTC)

Error (on 1.15.1)
This extension looks good, but on testing to see that it'll work as I want, I get the following error:

Fatal error: Call to protected method ChangesList::insertDateHeader from context 'NewsRenderer' in …/public_html/wiki/extensions/News/NewsRenderer.php on line 494

(Elision for paranoia reasons)

The wikicode trying to build the list is:

==News==

<news limit="10" unique namespaces="News" trigger="NEWSTEST" />

The last couple of calls on the stack (and the only ones in the extension) are (most recent first):

NewsRenderer->renderRow	../NewsRenderer.php:332 NewsRenderer->renderNews	../News.php:57

Does anyone have any idea, either that this needs fixing in the source, or a fix I can do myself? Thanks. --SamBC 17:15, 22 March 2010 (UTC)


 * Just noticed this seems to be the MW 1.13 problem. I'm definitely on 1.15.1, so I've no idea why this is happening, but I'll try the same workaround. SamBC 17:19, 22 March 2010 (UTC)


 * Fixed with kludgy addition of extends declaration to NewsRenderer. New problem in next section SamBC 17:40, 22 March 2010 (UTC)

Error trying to make pretty news list
So, trying to adapt this extension to make a pretty news list (and then feed), I tried the following wikicode:

<news limit="10" unique namespaces="News" trigger="NEWSTEST"> ===| - ===

When I then click on 'preview', I get the wonderful error:

Fatal error: Call to a member function getPrefixedDBkey on a non-object in …/public_html/wiki/includes/parser/Preprocessor_DOM.php on line 1038

The use of a level 3 header (presumably any header) seems to be the problem. Any ideas/fixes/workarounds? SamBC 17:44, 22 March 2010 (UTC)

PHP Warning: Parameter 3 to wfNewsTag expected to be a reference, value given
I get the following error messages here:

PHP Warning: Parameter 3 to wfNewsTag expected to be a reference, value given in /data/www/www.example.com/htdocs/includes/parser/Parser.php on line 3243,

MediaWiki 	1.15.1 PHP 	5.3.2 (apache2handler) MySQL 	5.0.90-log

I tried News-MW1.15-r48578.tar.gz and News-trunk-r65527.tar.gz without success.

AFAIK php-5.3 is somewhat picky about call by value/by reference.

Any ideas? --Rabe 16:59, 5 May 2010 (UTC)

on 1.15.1 complete failure
I have tried to get this extension to run on 1.15.1. Followed the instruction in detail, but nothing worked. Failure from 1.13 showed up (blank page). even to edit the NewsRenderer.php did not work.

There must be a major-bug in the extension.

Spaces in pagenames showing as underscores
Is there any way to make page names show without the underscore character which replaces spaces between the words of a page title?

I've been using the extension for a while now - with 1.16 too - and it does what I want well; but the appearance issue of those ugly underscores is beginning to rankle. See what I mean at WikiSpooks   --Sabretache 19:01, 24 July 2010 (UTC)


 * Sabretache, I couldn't get Extension:News to work with MW 1.16. Can I ask if you encountered any problems like this and how you solved them?--Siadsuit 16:16, 23 September 2010 (UTC)

1.15.1 bug - blank page
Hi, I installed the extension today and all I get is nothing literally. It doesn't display anything what so ever. The page works fine, and other syntaxes works too. It doesn't complain about the tags though, it just doesn't show anything.

Anyone got a clue why this happens?

MediaWiki   1.15.1 PHP	    5.3.2-1ubuntu4.2 (apache2handler) MySQL	    5.1.41-3ubuntu12.3

26.07.2010 by Duzzy

Me too
It looks like the Parser never calls wfNewsTag, wfNewsFeedTag, or wfNewsFeedTagLink. I added some wfDebug calls in there, and the wfNewsExtension call IS being made, but nothing after that. Sadness. Tsx11 07:22, 24 September 2010 (UTC)
 * Update I found out what the problem was - Me. I wasn't calling the extension properly in the wikitext. Here is an example of what worked for me




 * * (User:, )
 * <newsfeedlink feed="insert your page name here" format="rss" icon="rss.png" title="RSS feed">
 * Click here to follow
 * Click here to follow


 * So it looks like you must setup a newsfeed before you can call for a newsfeed link. In retrospect this looks obvious, but initially I was under the impression that all three of the tags could be given same parameters and the code could then render either a news/feed/feedlink as indicated. Doh!
 * Make sure you've uploaded rss.png FIRST, otherwise you'll get a blank screen when the renderer tries to make the link to a phantom image file! HTH. Tsx11 11:52, 1 October 2010 (UTC)

Display diff
Is there a way to display the diff rather than have a link? --Alanna.macnevin 17:28, 2 September 2010 (UTC)

Patch to show only Current Page & use from a Template
Hi, I like the News extension that you wrote. I made a small patch for it, to allow feeds to be created only for specific pages (adding an argument and a where clause to the query function). Do you want it? It's quick 2~5 lines of code. Here it is: Add to the NewsRenderer class variable declarations: var $onlythispage;

Add to the constructor: $this->onlythispage = @$argv['onlythispage']; if($this->onlythispage === 'false' || $this->onlythispage === 'no' || $this->onlythispage === '0') $this->onlythispage = false;

And the query function: if ( $this->onlythispage) $where[] = 'rc_title ='. $dbr->addQuotes($this->title->getDBkey);

I also added some code to use the functionality from a Template. To do this....
 * 1) Create a Template file (Template:News)
 * 2) Edit the template file to include whatever news/newsfeed/etc. that you want
 * 3) insert this little bit of code below into NewsRenderer.php inside the newFromArticle code (I stuck in after the $matches = array call and the Parser::extractTagsAndParams call. If anyone knows of a better way to do what this does in a better way, please tell (the extra DB access is somewhat lame).

//If this page uses a News Template, get the args from there $templateList = $article->getUsedTemplates; foreach($templateList as $t){ if($t->getText == "News"){ $templateArticle = new Article($t); $templateArticle->fetchContent; $text = $templateArticle->mContent; if (!$text){ wfDebug("NewsRenderer:newFromArticle ERROR. An empty template was included. Failing.\n"); return NULL; }                   break; }else wfDebug("NewsRenderer:newFromArticle ignoring ". $t->getText ."\n"); }

Hope this helps

Tsx11 06:07, 4 October 2010 (UTC)