Extension talk:News
Add topicBullet list starts with *?
[edit]Is it only my bullet list that has a * on the first row? How do i fix that?
Tobbe Wilson
SOLVED:
I had the same problem. I could solve it simply by pressing the return button once just before the opening of the <news> tag. With other words the <news> tag should be located at the beginning of a line because leading pipes e.g. in a table can cause side effects just like the wrong interpretation of the first bullet.
BIG RizZ (talk) 13:35, 21 September 2015 (UTC)
Text Scrolls Off Screen
[edit]Reproduce by
[jlroberts.08/17/12] <nowiki> This is happening to me as well, I use this wiki on occassion for my personal use, I vaguely remember upgrading php to 5.3.15 recently. I am running Amazon Linux AMI on an EC2 Instance. I will update when I figure out more. </no_wiki> (minus the _)
see below for fix
Error after upgrading to 1.19
[edit]I upgraded yesterday to 1.19. Today I realized that RecentChanges doesn't work anymore. I get the following error: Fatal error: Call to a member function getFullUrl() on a non-object in /.../htdocs/wiki/extensions/News/NewsRenderer.php on line 608 This extension is very important for me. Has anyone an idea what I could do?
[jlroberts.08/17/12]
This is happening to me as well, I use this wiki on occassion for my personal use, I vaguely remember upgrading php to 5.3.15 recently. I am running Amazon Linux AMI on an EC2 Instance. I will update when I figure out more.
[jlroberts.08/17/12 cont] To solve this, I install pcre-devel, yum install pcre-devel I should note, I was also receiving the following error PHP Warning: preg_replace(): Compilation failed: unknown option bit(s) set at offset 0
Error with 1.17
[edit]Call to protected method ChangesList::insertDateHeader() from context 'NewsRenderer' My software version:
Product | Version |
---|---|
MediaWiki | 1.15.4 |
PHP | 5.3.0 (apache2handler) |
MySQL | 5.1.37 |
what do i need to do to fix it?
Error
[edit]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
[edit]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:
<?php /* some code */ require_once( "$IP/extensions/News/News.php" ); ?>
this might and actually should help.
Inserting in a Template
[edit]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
[edit]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
[edit](code below)
- 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'.
Voila, the extension now works for MW < 1.10 (at least 1.8.2 and 1.9.3)
-- 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 ); } #no need to include, rely on autoloader #global $IP; #require_once( "$IP/includes/RecentChange.php" ); #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( '{{', '}}', '|', '$#39;' ), wfEscapeWikiText( $row->rc_comment ) ); // JLD:changes here $text = $this->parser->replaceVariables( $this->templatetext, $params ); return $text; } } } ?>
Images shown rather than linked
[edit]If an image makes it to the list then it will be displayed, rather than linked to. Is there a workaround?
<news limit="20" nominor unique>
* [[{{{pagename}}}]] by ([[User:{{{user}}}|{{{user}}}]] at {{{timeanddate}}})
</news>
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
{| <news limit="20" nominor unique prefix="|-\n|"> [[{{{pagename}}}]] by ([[User:{{{user}}}|{{{user}}}]] at {{{timeanddate}}}) </news> |}
- To take away the "magic" from links to images and categories, use a leading ":", i.e.
[[:{{{pagename}}}]]
instead of[[{{{pagename}}}]]
- To make a table, use something like this:
<news limit="20" nominor unique prefix="{|" postfix="|}"> |-- |[[{{{pagename}}}]] |([[User:{{{user}}}|{{{user}}}]] |{{{timeanddate}}}) </news>
- HTH -- Duesentrieb ⇌ 00:10, 25 May 2007 (UTC)
insert News From a RSS feed
[edit]Hi,
i prove to insert Links from a rss feed, but it dosent work..
What must i do?
real easy fix for 1.11
[edit]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;
--Alxndr 13:07, 11 September 2007 (UTC)
show categories
[edit]Got title, user etc. - how do I post categories as well?
- I had the same issue and finally found a solution to solve the problem. The reason why categories don't show up is that they're inserted automatically as [[Category:Categoryname]] and this way they can not be integrated into the text. They are treated as usual as categories and appear as category at the end of a page after you save your page. For categories to appear in the text the syntax has to be [[:Category:Categoryname]]. Yo need to add a : after the [[
- So to get this syntax with the NEWS EXTENSION parameters use [[:{{ns:{{{namespace}}}}}:{{{title}}}]]. The only drawback of this workaround is that pages with no prefix / namespace come along with a : infront.
- Example: http://xingkm.jaegerwm.de/index.php/xingKM_wiki:Gemeinschafts-Portal (see "Letzte Änderungen...")
Cheers! boris 13:55, 4 June 2011 (UTC)
- Works even better simply by running [[:{{{pagename}}}]]. Categories are shown, regular pages have no ":"-prefix.
regards 11:12, 1 January 2012 (UTC)
Old argument format?
[edit]Hi,
I'm an error saying:
Parser::replaceVariables called using the old argument format
When using the following code:
<news limit="10" onlynew> * [[{{{pagename}}}]] ([[User:{{{user}}}]], {{{timeanddate}}}) </news>
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
[edit]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
[edit]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 <path>/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)
- Receiving exact same error with PHP 5.2.6 and MediaWiki 1.13.4. as of 16:57, 9 February 2009 (UTC)
Fix for MW 1.13.2
[edit]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
- Thanks it helped me --Maksi
new images only
[edit]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"> {{{pagename}}} </news>
--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)
- changes of images are shown (if 'onlynew' is not present), but new created images are not. --Dnikitin 15:35, 3 March 2009 (UTC)
Playing with NamespacePermissions
[edit]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.
{{{content}}} uses relative URLs
[edit]I am trying to process my feed with Yahoo Pipes. However, the issue is that {{{content}}} 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 {{{content}}} 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
[edit]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"
[edit]Suggest to include the option: "onlyold".
For use:
{| |New pages: <news onlynew/> |- |Changed pages: <news onlyold/> |}
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)
Updated 2015
[edit]Good idea, very useful to separate changed and new pages. I implemented this on my installation and this fix is still functional. Note that the line numbers may differ slightly from above based on your installation. My 1.22.6 installation with News REL1_22-bc93b1f required the following modifications:
47 > var $onlyold; 200a202 > $this->onlyold = @$argv['onlyold']; > if ( $this->onlynew || $this->onlyold === 'false' || $this->onlyold === 'no' || $this->onlyold === '0' ) > $this->onlyold = false; 253 > if ( $this->onlyold ) $where[] = 'rc_new = 0';
Thank you, --Quantos (talk) 13:42, 4 March 2015 (UTC)
Undefined Variable
[edit]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"> {{{head}}} </newsfeed>
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
[edit]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
[edit]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)
- Still doesn't work on 1.16 :-(
Error (on 1.15.1)
[edit]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
[edit]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"> ===[[{{{pagename}}}|{{{title}}}]] - {{{timeanddate}}}=== {{{head}}} </news>
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
[edit]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
[edit]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
[edit]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)
- I don't recall doing anything special or hitting any particular snags. Just followed the instructions. It did take a bit of concentrated effort to get it as you see it on WikiSpooks but it's been working without a hitch for at least 3 months now. NOTE: I am actively looking at Dynamic page list as an alternative because I don't like those underscores. So page may well change soon after this post --Sabretache 15:49, 12 October 2010 (UTC)
- Turns out the underscores are part of the page canonical title. They can be removed by using "Pagename" instead of "title". The problem is that there is no way to prevent display of the namespace using "Pagename". The 'DynamicPageList' extension never shows the underscores but unfortunately you cannot select by last edit date. My solution thus far is to use a mixture of both the 'News' and 'DynamicPageList'. Results not perfect but getting there]. --Sabretache 14:39, 16 October 2010 (UTC)
This was bugging me too. I fixed it by hacking NewsRenderer.php. Find the line that says
$params['title'] = $row->rc_title;
and immediately under it, insert
$params['title'] = str_replace ( "_", " ", $params['title'] );
Seems to work for me! --David 218.249.14.231 09:05, 16 June 2011 (UTC)
- Great, thanks! Works for me either (MW 1.16.5) - Boris 09:32, 16 June 2011 (UTC)
1.15.1 bug - blank page
[edit]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
[edit]::I get the same problem. 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
- <newsfeed silent>
- * [[{{{pagename}}}]] ([[User:{{{user}}}]], {{{timeanddate}}})
- </newsfeed>
- <newsfeedlink feed="insert your page name here" format="rss" icon="rss.png" title="RSS feed">
- Click here to follow
- </newsfeedlink>
- 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
[edit]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
[edit]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....
- Create a Template file (Template:News)
- Edit the template file to include whatever news/newsfeed/etc. that you want
- 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)
Extension required
[edit]Does the news extension works with DynamicpagesList2 extension?
Not working in 1.18
[edit]I get the following error in MediaWiki 1.18
extensions/News/NewsRenderer.php on line 450 Notice: Undefined variable: permaq in NewsRenderer.php on line 450 Notice: Undefined variable: permaq in extensions/News/NewsRenderer.php on line 450 Notice: Undefined variable: permaq in NewsRenderer.php on line 450 Notice: Undefined variable: permaq in extensions/News/NewsRenderer.php on line 450 Notice: Undefined variable: permaq in NewsRenderer.php on line 450 Notice: Undefined variable: permaq in ... Warning: Cannot modify header information - headers already sent by (output started at /path/to/website/extensions/News/NewsRenderer.php:450) in /path/to/wiki/includes/WebResponse.php on line 38 Warning: Cannot modify header information - headers already sent by (output started at /path/to/wiki/extensions/News/NewsRenderer.php:450) in /path/to/wiki/includes/WebResponse.php on line 38
My contributions and Recent Changes not working in 1.18
[edit]I get the following error in MediaWiki 1.18 when selecting my contributions, or recent changes:
Notice: Undefined property: SkinMonoBook::$mTitle in /opt/lampp/htdocs/Wiki/extentions/News/News.php on line 116 Fatal error:Call to a member function getFullUrl() on a non-object in /opt/lampp/Wiki/extentions/News/NewsRenderer.php on line 608
rawtime ignores user's timezone
[edit]Time throws off for anyone not in UTC/in server's time. --Merrinen (talk) 18:01, 1 May 2012 (UTC)
- Complain and find out you must use {{#timel: Y.m-d | {{{rawtime}}} }} instead of {{#time: Y.m-d | {{{rawtime}}} }} - hope this information helps someone else who thinks this is an issue with the News extension. --Merrinen (talk) 18:07, 1 May 2012 (UTC)
Handle new categories
[edit]Overall, this extension works great. However, I find the new categories are empty (e.g. http://www.fclose.com/w/News ). I want a "clean" list of recent new pages. The template I use is
<news limit="50" noanon nobot nominor unique notalk onlynew namespace=0> * [[{{{pagename}}}]] at {{{timeanddate}}} </news>
- I figured out a trick: just for those who may also need it
<news limit="50" noanon nobot nominor unique notalk onlynew namespace=0 > * [[:{{{pagename}}}]] at {{{timeanddate}}} </news>
Fix
[edit]If you want to fix this in the code do the following; On line 499 of NewsRenderer.php Change
$params['pagename'] = $title->getPrefixedText();
to
$params['pagename'] = ($title->getNamespace() == NS_CATEGORY ? ':' : '').$title->getPrefixedText();
--Tekmosis (talk) 19:07, 30 August 2013 (UTC)
Broken in 1.21.1
[edit]I had to disable it because it crash the site, I got the following eror
[Fri Jun 28 15:59:19 2013] [error] [client XXX.XXX.XXX.XXX] PHP Fatal error: Call to undefined method ParserOptions::setUseDynamicDates() in /var/www/fountainpen.it/mediawiki/extensions/News/NewsRenderer.php on line 108, referer: https://www.fountainpen.it/Speciale:PagineSpeciali
- I commented out the line in question in NewsRenderer.php. Now the extension seems to work again
no feed found on page:
[edit]Hello,
I've got a problem with the News extension, MediaWiki 1.21.2
The generation of a feed article works perfectly (i named it WikiFeeds)
But when I open index.php?title=WikiFeeds&feed=atom (or rss), I've got "Not Found / no feed found on page: News"
It's working well in an old version of Mediawiki (1.11) do you have an idea of what I may have missed?
--AshLeDombos (talk) 21:15, 3 October 2013 (UTC)
- When NewsRenderer.php line 53ff is changed from
$article->getContent(); $text = $article->mContent;
to$text = $article->getContent();
, functionality is restored, but this needs a long-term fix, as Article::getContent() is deprecated.
- Thanks this is working now! I hope there is a long term solution, because this plugin is a must have imho :) --AshLeDombos (talk) 08:11, 12 October 2013 (UTC)
- I logged this issue in the bug tracker so that it hopefully gets some developer attention. --Esplinr (talk) 01:11, 9 April 2014 (UTC)
how to exclude non-existing pages?
[edit]I don't want to see deleted pages in the list. Can I exclude them?
- In version 1.27 still no solution!? Similar problem: When I have moved a page to a new name (one or more times), this extension shows the oldest name. Wschroedter (talk) 19:58, 23 April 2017 (UTC)
Exclude category?
[edit]Is it possible to exclude a category?
I.e. i want every recent change to appear in the news, but not the ones that have a specific category.
Custom namespaces are being IGNORED with MW 1.25
[edit]For some reason custom namespaces are being IGNORED with MW 1.25, using either the namespace name OR namespace number.
Am I the only one this is happening to?
--BradLeeBH (talk) 11:13, 6 September 2015 (UTC)
Problem with 1.26.2
[edit]The News extension seems to have a problem with the "unique"-Tag in Version 1.26.2 Mediawiki. It shows all edits of the page, not only the latest. Is there a fix for this?
Undefined index: page_latest
[edit]MW 1.27 When using this extension without a template, I get this error:
Undefined index: page_latest in WIKI/includes/changes/ChangesList.php on line 587
I was able to track down the issue, and resolve it by adding a line to the function 'renderRow'
$change->mAttribs['page_latest'] = 0;
before this line:
$html = $this->changelist->recentChangesLine( $change );
This has something to do with the display of the 'rollback' function. There might be a better way to do it, though.
New page displayed in list of recent edits. How fix?
[edit]I used two tegs to displayed lists.
To new pages, is:
<news limit="10" onlynew="true"> * [[{{{pagename}}}]] ([[User:{{{user}}}]], {{{timeanddate}}}) </news>
To recent edits, is:
<news limit="10" unique="true"> * [[{{{pagename}}}]] ([[User:{{{user}}}]], {{{timeanddate}}}) </news>
What need do it that for new page must be not displayed in list of recent edits?
Exclude pages
[edit]Thanks for this nice extension! I like it very much.
For the future, it would be cool to have the possibility to exclude certain pages. In my wiki for example, i have a Sandbox-page for testing purposes, but changes there are not of interest for normal users. Marccreal (talk) 12:36, 26 July 2017 (UTC)