Extension talk:Newest Pages

Please submit bug reports and feature requests for this extension to the extension's maintainer, Rob Church, via email.

Narrow to a given Namespace
Thanks, this is very helpful. Any chance you could add a param to allow the namespace to be specified? I'd like to transclude this page as a kind of "Table of Contents" for a specific namespace.


 * Available as of version 1.3. Rob Church (talk) 23:27, 13 May 2006 (UTC)

Namespace as a Category Page?
I was wondering if the Namespace that can be specified could actually specify a Category Page? skdb 15:04, 29 June 2006 (UTC)

What is the namespace for "Pages"
Thanks a lot - this is wonderful! It works with categories and most namespaces. But I wonder what would be the namespace to write if I want to have pages/articles only. I can select "(Artikel)" (German for articles = pages) in the selectbox but I do not know the word to write as namespace... Thanks a lot! --194.76.29.2 15:37, 17 July 2006 (UTC)


 * I had this same problem and after trial-and-error discovered that to filter for articles in the (Main) namespace the syntax is 71.35.247.211 02:24, 10 August 2006 (UTC)

Section #3 of the README states, "Use - to select the main namespace." 86.134.116.228 08:16, 15 August 2006 (UTC)

Questions

 * How do I link to namespace Main?
 * Special:Newestpages/-
 * This was noted in the README file. robchurch | talk 14:32, 20 November 2006 (UTC)

Index: NewestPages.page.php
 * How do I refine the code, so the namespace Main will appear as default?

=
====================================================== --- NewestPages.page.php	(revision 17805) +++ NewestPages.page.php	(working copy) @@ -66,7 +66,7 @@ 		if( !isset( $this->limit ) ) $this->limit = $this->sanitiseLimit( $req->getInt( 'limit', $wgNewestPagesLimit ) ); if( !isset( $this->namespace ) ) -			$this->namespace = $this->extractNamespace( $req->getVal( 'namespace', -1 ) ); +			$this->namespace = $this->extractNamespace( $req->getVal( 'namespace', NS_MAIN ) ); if( !isset( $this->redirects ) ) $this->redirects = (bool)$req->getInt( 'redirects', 1 ); }

Index: NewestPages.page.php
 * How do I refine the code, so the redirect pages will not appear as default?

=
====================================================== --- NewestPages.page.php	(revision 17805) +++ NewestPages.page.php	(working copy) @@ -68,7 +68,7 @@ 		if( !isset( $this->namespace ) ) $this->namespace = $this->extractNamespace( $req->getVal( 'namespace', -1 ) ); if( !isset( $this->redirects ) ) -			$this->redirects = (bool)$req->getInt( 'redirects', 1 ); +			$this->redirects = (bool)$req->getInt( 'redirects', 0 ); } 	function sanitiseLimit( $limit ) {


 * How can I filter and show new articles within a category?
 * This isn't supported in this extension at the present time. It might be added as a feature in a subsequent release, as it's a popular request. robchurch | talk 14:35, 20 November 2006 (UTC)


 * I've answered the remaining questions above. Please note that I reviewed this discussion page by chance; wherever possible, I prefer extension questions like this to be emailed to me; an address is provided in the README file for that purpose. Thanks. robchurch | talk 14:35, 20 November 2006 (UTC)

showing certain categorie
Hi I was wondering if it is possible just to show the main categorie on the front main page instead of it going to the all categorie... ty Nevermind I figured it out... Thanks for this extensions...!!

Couldn't you have said what you figured out?--195.13.55.197 22:30, 7 October 2008 (UTC)

Error message with wfLoadExtensionMessages
Im getting the error: Fatal error: Call to undefined function wfLoadExtensionMessages in /var/www/wiki/extensions/newestPages/NewestPages.page.php on line 26

After research I found one page that states that wfLoadExtensionMessages is only available in version 1.11 and above. (Extension:Cite/Cite.php). Therefore this extension won't work on 1.6 and above. Is this correct? (We still at 1.9 :


 * Due to a bunch of incompetent messing around with the code for this extension, and the removal of perfectly reasonable backwards-compatibility code, several people are experiencing problems; I've just responded to another email from an exasperated user attempting to install the extension.


 * If you're running a pre-1.11 wiki, I'd suggest using the version as of r23533, which can be considered the last version "released" by Rob Church. A tarball of these files can also be found at http://www.anubite.co.uk/newestpages-1.6.x.tar.gz.


 * I'd update the page, but some clever idiot would just undo it. -- Rob Church

Specify offset of first "Newest Page" displayed
Here's a patch that allows one to specify not only the number of pages to display, but also the index of the first page: Index: NewestPages.page.php

=
====================================================== --- NewestPages.page.php       (revision 42072) +++ NewestPages.page.php       (working copy) @@ -13,6 +13,7 @@ class NewestPages extends IncludableSpecialPage {

var $limit = NULL; +      var $offset = "0"; var $namespace = NULL; var $redirects = NULL;

@@ -46,13 +47,14 @@               $page = $dbr->tableName( 'page' ); $nsf = $this->getNsFragment; $redir = $this->redirects ? '' : ' AND page_is_redirect = 0'; -              $res = $dbr->query( "SELECT page_namespace, page_title, page_is_redirect FROM $page WHERE {$nsf}{$redir} ORDER BY page_id DESC LIMIT 0,{$this->limit}" ); +              $res = $dbr->query( "SELECT page_namespace, page_title, page_is_redirect FROM $page WHERE {$nsf}{$redir} ORDER BY page_id DESC LIMIT {$this->offset},{$this->limit}" ); $count = $dbr->numRows( $res ); if( $count > 0 ) { # Make list if( !$this->mIncluding ) $wgOut->addWikiText( wfMsg( 'newestpages-showing', $count ) ); -                      $wgOut->addHtml( "" ); +                      $start = 1 + (int)$this->offset; +                      $wgOut->addHtml( "" ); while( $row = $dbr->fetchObject( $res ) ) $wgOut->addHtml( $this->makeListItem( $row ) ); $wgOut->addHTML( "" ); @@ -81,7 +83,11 @@                       $bits = explode( '/', $par ); foreach( $bits as $bit ) { if( is_numeric( $bit ) ) { -                                      $this->limit = $this->sanitiseLimit( $bit ); +                                      if ( !isset( $this->limit ) ) { +                                              $this->limit = $this->sanitiseLimit( $bit ); +                                      } else { +                                              $this->offset = $this->sanitiseLimit( $bit ); +                                      }                                } else { $this->namespace = $this->extractNamespace( $bit ); }

This way, you can easily create a multi-column table of newest pages, like so:

Gets slow using conditions on a bigger wiki
Not that my wiki is big but I have ~17000 articles and the page with the include takes pretty long to load as soon as I start to add conditions to the query :/ Just FYI --Subfader 02:10, 6 February 2009 (UTC)

Bug: Incompatible with postgres 8.3
when using the debian package mediawiki-extensions 1.4 containing Newest Pages 1.7 with MediaWiki 	1.12.0 PHP 	5.2.6-1+lenny2 (apache2handler) PostgreSQL 	PostgreSQL 8.3.6 on i486-pc-linux-gnu, compiled by GCC gcc-4.3.real (Debian 4.3.3-3) 4.3.3 i get this error: Interner Fehler

A database error has occurred Query: SELECT page_namespace, page_title, page_is_redirect FROM page WHERE page_namespace != 8 ORDER BY page_id DESC LIMIT 0,50 Function: Error: 1 FEHLER: Syntax LIMIT x,y wird nicht unterstützt HINT: Verwenden Sie die getrennten Klauseln LIMIT und OFFSET.

Backtrace:

note that no pages where created before
 * 1) 0 /usr/share/mediawiki/includes/Database.php(799): DatabasePostgres->reportQueryError('FEHLER: Syntax...', 1, 'SELECT page_nam...', '', false)
 * 2) 1 /usr/share/mediawiki-extensions/NewestPages.page.php(49): Database->query('SELECT page_nam...')
 * 3) 2 /usr/share/mediawiki/includes/SpecialPage.php(464): NewestPages->execute(NULL)
 * 4) 3 /usr/share/mediawiki/includes/Wiki.php(193): SpecialPage::executePath(Object(Title))
 * 5) 4 /usr/share/mediawiki/includes/Wiki.php(45): MediaWiki->initializeSpecialCases(Object(Title), Object(OutputPage), Object(WebRequest))
 * 6) 5 /usr/share/mediawiki/index.php(90): MediaWiki->initialize(Object(Title), Object(OutputPage), Object(User), Object(WebRequest))
 * 7) 6 {main}

Sorting Order ?
Is there a way to define the sorting order? i would like to display the very newest page on top of the list. Currently in my list of 10 newest pages the newest page is on bottom. Thanks in advance regards --TurboKanne 13:12, 15 September 2009 (UTC)

Blank line
Why does the extension add a blank line before the list when I embed it in another page? --91.17.211.128 17:28, 13 May 2010 (UTC)

Exclude redirects from included list
What do I have to do (even if it is only possible by editing the extension code) to exclude redirects from included lists of newest pages? Thank you... (Rob) --89.247.150.88 13:18, 24 September 2010 (UTC)


 * I'd like to know this, too. --Chriswaterguy 18:16, 11 January 2011 (UTC)


 * Me too - seems to have been changed somewhere between MW version 1.13.2 (which did not include redirects) and 1.15.4 (which does). --Robinson weijman 14:42, 19 January 2011 (UTC)


 * Found it. In the setOptions function, find:

if( !isset( $this->redirects ) ) this->redirects = (bool)$req->getInt( 'redirects', 1 );
 * and change the 1 to a 0, i.e. the last line should be:

this->redirects = (bool)$req->getInt( 'redirects', 0 ); --Robinson weijman 15:03, 19 January 2011 (UTC)

A better option line 67: global $wgNewestPagesLimit, $wgNewestPagesShowRedirects; line 73: $this->redirects = (bool)$req->getInt( 'redirects', $wgNewestPagesShowRedirects); and then in LocalSettings.php: $wgNewestPagesShowRedirects = 0; This way it can be changed without editing the code of the extension any longer. Hopefully the author will add it to the code. Beta M 08:28, 3 March 2011 (UTC)

Article Summary
Is there a method by which one can add a summary & author underneath the articles listed? Something similar to the method utilized by the extension Wikilog. --Enterprise user 19:13, 24 January 2011 (UTC)

Add a nav Bar?
Is there a way to add a navigation bar, IE Prev. 10, Next 10, or whatever your variable is? --Unsigned


 * The dev of this extension is inactive. Don't expect much here. --Subfader 11:22, 24 April 2011 (UTC)

Changed list type to bullet list (ul)
Hi, I have changed the default list type from HTML "ordered list" (ol) to HTML "unordered list" (ul) by simply changing two lines in extensions/NewestPages/NewestPages.page.php to have a common appearance. See http://www.denken24.de (MediaWiki 1.16.5):

$wgOut->addHTML( "" ); [...] $wgOut->addHTML( "" );

Thanks --Netzschrauber 13:26, 15 May 2011 (UTC)