Extension talk:Newest Pages

From mediawiki.org
Latest comment: 9 months ago by in topic Exclude redirects from included list
Please submit bug reports and feature requests for this extension to the extension's maintainer, Rob Church, via email.
The following discussion has been transferred from Meta-Wiki.
Any user names refer to users of that site, who are not necessarily users of MediaWiki.org (even if they share the same username).

Download link is dead[edit]

Your download link is dead :(.

Narrow to a given Namespace[edit]

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)Reply[reply]

Namespace as a Category Page?[edit]

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

What is the namespace for "Pages"[edit]

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! -- 15:37, 17 July 2006 (UTC)Reply[reply]

I had this same problem and after trial-and-error discovered that to filter for articles in the (Main) namespace the syntax is {{Special:Newestpages//X}} 02:24, 10 August 2006 (UTC)Reply[reply]

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


Only one possible selection for NewestPages

I have a problem with my NewestPages selections. Why i cant show the three selections on one (Main)Page? When I try to use them alone, the aren't any Problem. Pls help

greetz Graffo

<!--        MAIN PAGE BANNER        -->
{{#if:{{Main Page banner}}|
<table id="mp-banner" style="width: 100%; margin:4px 0 0 0; background:none; border-spacing: 0px;">
<tr><td class="MainPageBG" style="text-align:center; padding:0.2em; background-color:#fffaf5; border:1px solid #f2e0ce; color:#000; font-size:100%;">{{Main Page banner}}
<table width="100%">
<td width="33%"> <b>Neueste Artikel:</b> <br> {{Special:Newestpages/-/10}} </td>
<td width="33%"> <b>Neueste Benutzer:</b> <br> {{Special:Newestpages/User/10}} </td>
<td width="33%"> <b>Neueste Kategorien:</b> <br> {{Special:Newestpages/Category/10}} </td>
How do I link to namespace Main?
This was noted in the README file. robchurch | talk 14:32, 20 November 2006 (UTC)Reply[reply]
How do I refine the code, so the namespace Main will appear as default?
Index: NewestPages.page.php
--- 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 );
How do I refine the code, so the redirect pages will not appear as default?
Index: NewestPages.page.php
--- 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)Reply[reply]
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)Reply[reply]

showing certain categorie[edit]

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?-- 22:30, 7 October 2008 (UTC)Reply[reply]

Error message with wfLoadExtensionMessages[edit]

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[edit]

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( "<ol>" );
+                       $start = 1 + (int)$this->offset;
+                       $wgOut->addHtml( "<ol start=\"$start\">" );
                        while( $row = $dbr->fetchObject( $res ) )
                                $wgOut->addHtml( $this->makeListItem( $row ) );
                        $wgOut->addHTML( "</ol>" );
@@ -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:

<table width="100%">
<td width="33%">{{Special:Newestpages/-/5}} </td>
<td width="33%">{{Special:Newestpages/-/5/5}} </td>
<td width="33%">{{Special:Newestpages/-/5/10}} </td>

Gets slow using conditions on a bigger wiki[edit]

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)Reply[reply]

Bug: Incompatible with postgres 8.3[edit]

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.


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

Sorting Order ?[edit]

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
--TurboKanne 13:12, 15 September 2009 (UTC)Reply[reply]

Blank line[edit]

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

Exclude redirects from included list[edit]

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) -- 13:18, 24 September 2010 (UTC)Reply[reply]

I'd like to know this, too. --Chriswaterguy 18:16, 11 January 2011 (UTC)Reply[reply]
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)Reply[reply]
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)Reply[reply]

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)Reply[reply]

$wgNewestPagesShowRedirects = 0; doesn't work anymore as of 1.39.1 19:09, 22 February 2023 (UTC)Reply[reply]

Article Summary[edit]

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)Reply[reply]

Add a nav Bar?[edit]

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)Reply[reply]

Changed list type to bullet list (ul)[edit]

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( "<ul>" );
$wgOut->addHTML( "</ul>" );

Thanks --Netzschrauber 13:26, 15 May 2011 (UTC)Reply[reply]

I have created a feature request for this here. 11:09, 15 November 2014 (UTC)Reply[reply]

Add date to the list[edit]

IMHO it would be nice to have the creation date of the pages in the list. Something like this:

  1. Newest_Pages (2012-05-24)
  2. Another page (2011-12-18)

IMHO it's more informative. -- 08:15, 24 May 2012 (UTC)Reply[reply]

I agree, just came on the discussion page looking at some information about it, so +1 for me. Symac (talk) 15:03, 11 July 2012 (UTC)Reply[reply]
The dev retired from coding for MediaWiki. You have to hack it yourself. --Subfader (talk) 06:48, 12 July 2012 (UTC)Reply[reply]

Cannot download?[edit]

The extension distributor says there's no such extension as "NewestPages". Huwmanbeing (talk) 10:38, 5 December 2012 (UTC)Reply[reply]

How to exclude certain category?[edit]

Is it possible to exclude pages from a certain category?
I have a draft category which pages shouldn't show up in the newest pages list as longs as they are drafts.
Thanks for any help.
Stefahn (talk) 15:11, 15 September 2013 (UTC)Reply[reply]

How to only list pages in time/date limid[edit]

How do i list pages created in a certain month or from/to a certain date.??

Please !! ... OMg: )[edit]

Please, add a index to "page" database. (On column page_latest),

It's very slow on big wiki ;)

NewestPages Error 500[edit]

Who can use NewestPages Extensions on PHP 7.2 ?

Add 'noredir'-parameter[edit]

diff --git a/NewestPages/NewestPages.page.php b/NewestPages/NewestPages.page.php
index 46b754d..0312d72 100644
--- a/mediawiki-kochwiki/extensions/NewestPages/NewestPages.page.php
+++ b/mediawiki-kochwiki/extensions/NewestPages/NewestPages.page.php
@@ -115,7 +115,10 @@ class NewestPages extends IncludableSpecialPage {
 				if ( is_numeric( $bit ) ) {
 					$this->limit = $this->sanitiseLimit( $bit );
 				} else {
-					$this->namespace = $this->extractNamespace( $bit );
+					if ( $bit == 'noredir' )
+						$this->redirects = false;
+					else
+						$this->namespace = $this->extractNamespace( $bit );

-- NikiWiki (talk) 19:10, 28 December 2018 (UTC)Reply[reply]

Main space also outputs project namespace[edit]

When I try to search the newest posts only in Main space, the extension also shows me all pages in Project namespace.

Why are subpages listed, too, when I only want to see newest pages in the main namespace?[edit]

In my wiki, I have set up the LocalSettings.php to have this parameter:

# Enable subpages in the main namespace
$wgNamespacesWithSubpages[NS_MAIN] = true;

This works fine for showing subpages and the relevant bread crumbs back to the main articles. But in my wiki's homepage, where I want to list the 10 newest pages using


subpages are also listed. What am I doing wrong? --Ulf Dunkel (talk) 15:18, 2 February 2022 (UTC)Reply[reply]