Extension talk:DynamicPageList/Archive 02

More mode options

It would be nice to see that in mode= you would have the option to list them similar to how {{:Special:Wantedpages/5}} gets listed. Thank's for your time. --Steinninn 05:51, 2 June 2007 (UTC)

Some questions

  1. Where is the documentation for this, given that it is not the same as any other DynamicPageList?
  2. If no documentation is available, where is the source? I can't find it on SVN, but Wikimedia projects are open source, so of course the code must be available somewhere so that someone can inspect the code and find out how it works.

Thanks!

--McCormack 13:08, 10 March 2008 (UTC)

The answer to my question is that on SVN, the lowercase extension names are listed after the uppercase ones, and this is a lowercase one. Once you know that, you can find the source! (/trunk/extensions/intersection) --McCormack 13:17, 10 March 2008 (UTC)

Additions for use of templates

I've added a patch in bugzilla bugzilla:13692 to allow use of templates instead of just creating plain links. Jeblad 11:53, 11 April 2008 (UTC)

How difficult to change output format?

How difficult would it be to change the output format so that results were ranked not based on what is newest but on alphabetical order of one of the categories (when showing results from a union of categories)? I'm not into coding myself, would probably need help for that.--Kassoe 07:53, 2 May 2008 (UTC)

Usage is undocumented

At the moment two important questions remain completely unanswered by this extension wiki page or comments inside the code itself:

  • How to use this extension? Does it create a Special: page (I found none)? Does it act on a tag inside of pages? Which? Which parameters?
  • Given that the name is DynamicPageList.php, does it conflict with using Extension:DynamicPageList? A question about identity above was answered that these are different things, but the question about documentation or usage was left unanswered.

We tried installing it and have to turn it off now. Given that this extension is highlighted as reliable and used by Wikimedia, it would be desirable to extend the documentation. Many thanks! --Vigilius 05:49, 29 July 2008 (UTC)

This exetension is installed on Wikimedia wikis and the documentation can be find here at meta, while extension:dynamicPageList is more complex. It seems that the extensions doesn't conflict (intersection one create a <dynamicpagelist> tag while dynamicpagelist one create a <dpl> tag and magic words {{#dpl:, {{#dplchapter:, {{#dplmatrix:. It is a mess :S --Ramac 18:42, 29 July 2008 (UTC)

include or require?

Why include and not require? NSK Nikolaos S. Karastathis 03:46, 27 October 2008 (UTC)

require makes php die if the file can't be found, include continues running the script but throws out an error. Thus, if you want to make sure that you have the extension installed, use require.
As for require vs. require_once, require_once is preferred because some extensions re-load configuration files (such as LocalSettings.php), and having a require there instead of require_once would throw mediawiki into an infinite loop. require_once only executes the file once, and ignores it in future requests, which makes it much safer for those scripts that recursively process these files.
Taken from a post on the Mediawiki User Forum. --Tlosk 03:09, 13 July 2009 (UTC)

outdated

The documentation here is somewhat outdated. n:Wikinews:DynamicPageList is up to date. Bawolff 21:30, 30 January 2009 (UTC)


Problems

I installed the extension on a private wiki according to the notes on the page (#include("$IP/extensions/intersection/DynamicPageList.php");), but it doesn't work. When I disable (commtenting out) the extension in the localsettings.php, I can see the page. If I enable the extension I only get a white page displayed on pages with Error: You need to include at least one category, or specify a namespace!, all other pages can be edited and shown. (Setup: Mediawiki 1.13.2, Php 5.1.2 (apache2handler), MySql 5.0.26 und folgende Extensions ExpandTemplates (Version 2008-01-09) BugzillaReports (Version 0.9.8) Cite DynamicPageList Inputbox LabeledSectionTransclusion ParserFunctions (Version 1.1.1) SimpleSecurity (Version 4.2.14, 2008-09-12) SyntaxHighlight (Version r37495) AWC`s MediaWiki Forum )

Thanks for helping --Joergens.mi 11:01, 6 February 2009 (UTC)

Bug in Date Format?

This extension is very nice and works, but delivers unfortunately wrong dates.

By using the original line (# 448) in DynamicPageList.php:

$output .= $wgLang->date($row->cl_timestamp) . wfMsg( 'colon-separator' ); 

brings

2009 <> 6

By using the timeanddate-function, which should be adequate:

$output .= $wgLang->timeanddate($row->cl_timestamp) . wfMsg( 'colon-separator' );

brings perfectly

15:07, 2009 Jun. 12

Any ideas? --Jostar 11:41, 8 July 2009 (UTC)

My versions:
MediaWiki 1.14.0
PHP 5.2.9 (apache2handler)
MySQL 5.1.33-community

related to: time(), date(), and timeanddate()

Display date of last edit instead of category add

Ideally this could be set up as an additional variable as was suggested in the feature request made above in 2008, however if you only want to display the date the displayed pages were last modified (page_touched) rather than the date the article was first added to the category (cl_timestamp) it can be accomplished by altering the following two lines in DynamicPageList.php:

LINE 337
$sSqlSelectFrom = "SELECT page_namespace, page_title, page_id, c1.cl_timestamp FROM $sPageTable";

CHANGE TO:

$sSqlSelectFrom = "SELECT page_namespace, page_title, page_id, page_touched, c1.cl_timestamp FROM $sPageTable";


LINE 448
$output .= $wgLang->date($row->cl_timestamp) . wfMsg( 'colon-separator' );

CHANGE TO:

$output .= $wgLang->date($row->page_touched) . wfMsg( 'colon-separator' );

OR

$output .= $wgLang->timeanddate($row->page_touched) . wfMsg( 'colon-separator' );

The first will display only a date, the second the time and the date.

After modifying, setting addfirstcategorydate=true will display the last edit dates. Note though that clearing the cache of a page (forcing a refresh) will also set the page_touched date as well as an actual edit. --Tlosk 03:35, 13 July 2009 (UTC)

How can I use category names with ampersand?

DPL is used in template:


<includeonly>{{#dpl:
|ordermethod=firstedit
|order=descending
|mode=userformat
|category={{#replace:{{#replace:{{PAGENAME}}|Photo |}}|&amp;|&}}
|namespace=Image
|noresultsheader=<nowiki />
|format=,,{{Photo|%TITLE%}},
}}</includeonly>

for example: PAGENAME=Photo Royal Cliff Grand Hotel & Spa 5*

DPL finds nothing, if {{#replace:{{#replace:DynamicPageList/Archive 02|Photo |}}|&amp;|%26}}, DPL finds it is necessary, but besides a lot of superfluous.

How to make correctly?

Thanks.

DAR, 10:50, 1 Aug 2009 (UTC)

This is the wrong page. You are using the third party dpl. this is the talk page for the wikimedia dpl (the one that uses <DynamicPageList>). Bawolff 06:03, 28 November 2009 (UTC)

Feature Request: DPL query with SMW properties

I would like to enable fine tune a DPL query so that it will also include SWM properties.

<DPL>
category = A
property = "HasFeature=Yes"
</DPL>
If SMW worked on everything, including categories, it could do all of this much better than DPL could. It is designed for producing sophisticated lists, but for some reason it can't deal with categories, templates, properties, etc. Badon 03:55, 12 July 2011 (UTC)

Add mode=gallery

I made a patch for having a gallery output mode. See bugzilla:21669. Bawolff 06:05, 28 November 2009 (UTC)

How to get a list with half of the pages in a category?

I'm trying to set the "count" parameter using the command #expr, but it doesn't works (it shows the whole list)

{{#tag:dynamicpagelist
|category = MediaWiki Introduction
|count    = {{#expr:trunc({{#tag:PAGESINCATEGORY:MediaWiki Introduction}}/2)}}
|ordermethod = sortkey
|order = ascending
}}

Does anybody knows how to do it properly? Helder 20:33, 4 May 2010 (UTC)

You're on the right track. You do need to use #tag, but don't use all the pipes (pipes are for tags that use xml style attributes), and PAGESINCAT does not need #tag. Try:
{{#tag:DynamicPageList|
category = MediaWiki Introduction
count    = {{#expr:trunc({{PAGESINCATEGORY:MediaWiki Introduction}}/2)}}
ordermethod = sortkey
order = ascending
}}

Also bear in mind that this won't work for categories with more then 400 articles (since dynamicPageList will only list at most 200 articles). Cheers, let me know if it works. Bawolff 06:00, 5 May 2010 (UTC)

Thank you! It works now! :-) Helder 13:41, 5 May 2010 (UTC)

At http://radiocontrolpedia.com I have the following markup:

<DynamicPageList>
category = Transmitter
mode     = gallery
namespace= file
</DynamicPageList>

and yet it's shown as a list, not a gallery. What am I doing wrong?

Looks like you might have an older version of the extension. Do you have the latest version? (Special:ExtensionDistributor/intersection you may have to select Trunk for the version, as the version for 1.15.x is too old. The latest version should still work with 1.15 afaik). Bawolff 20:17, 22 July 2010 (UTC)

Multiple namespaces or categories?

It seems there is no way to generate a single list with more than one namespace included. I'd like to create a list with shows recent pages from the "Talk:" and "User:" namespaces, but haven't got it to work without generating two separate lists. Any way to do this, or is it a planned/possible feature? --CarlosNZ 03:34, 26 July 2010 (UTC)

At the moment no, and there are no immediate plans to add that (that I am aware of). However if you make two lists right beside each other, it looks like a single list. Bawolff 05:04, 26 July 2010 (UTC)
Okay, thanks for the reply. --CarlosNZ 11:02, 26 July 2010 (UTC)

I made a simple request with the extension, and the extension works well, the pages appears with the links in blue and the list is correct, but when i edit and save again, the links appears in red (as if the page doesn't exist). The code is:

<DynamicPageList>
category = Category 1
category = Category 2
category = Category 3
</DynamicPageList>

I don't know why this happens.
Thx.
--Carlos12 07:01, 28 September 2010 (UTC)

Thats unbelievably weird (esp because it uses the known option of the link() function). Do you have a link to a public wiki where this behaviour is happening? Does this happen consistently, and what versions of this extension and mediawiki are you using? Bawolff 10:55, 29 September 2010 (UTC)

Parser evaluation also for 'namespace' parameter

It would be very helpful to be able to use namespace = {{NAMESPACE}}. The code change below works fine. Can someone add it to SVN please? Thank you!

			case 'namespace':
				$ns = $wgContLang->getNsIndex($parser->transformMsg($sArg, $poptions));
				if ( null != $ns ) {
                                ...
No need to hack the source code. You gotta use #tag:
{{#tag:DynamicPageList|
namespace = {{NAMESPACE}}
}}
--Subfader 16:52, 22 January 2011 (UTC)

feature request: ordermethod=random

What do you think about adding an ordermethod=random? --Wolfgang 18:15, 28 October 2010 (JST)

Depends if we care about efficiency or not (Since we already have stuff that is probably as inefficient as this would be, that probably doesn't matter too much). Also there are two concepts of random. The first one is have a different list on every page load (or at least on every cache purge). The second concept is to sort based on some hash of the article title (or page_random, or something similar), which orders the articles "randomly" but it is the same random order every time. Which do you mean? Bawolff 13:49, 28 October 2010 (UTC)
Thanks for your quick reply. The one I meant was random on every page load (or cache purge). I can't think of a use case for page_random (based on hash) right away, but they might exist of course. --Wolfgang 23:00, 29 October 2010 (JST)
Yeah, that definitely seems the more useful one. The main issue is that it would only re-order the list when the cache gets purged, which makes it slightly less useful, but it still might be useful. Bawolff 17:15, 29 October 2010 (UTC)
Can you give me any hints on how to add it? I looked at DynamicPageList.php but my SQL and mediawiki database knowledge is too limited to know how to add a randomize case. I see others like $sSqlSort = 'c1.cl_timestamp' etc. Is there an easy $sSqlSort assignment that will make it work? --Wolfgang 10:35, 30 Oct 2010 (JST)

Here's a quick patch to DynamicPageList.php. I havn't really tested this, but it definitly should work:

Index: DynamicPageList.php
===================================================================
--- DynamicPageList.php	(revision 75691)
+++ DynamicPageList.php	(working copy)
@@ -243,6 +243,9 @@
 				break;
 			case 'ordermethod':
 				switch ( $sArg ) {
+					case 'random':
+						$sOrderMethod = 'random';
+						break;
 					case 'lastedit':
 						$sOrderMethod = 'lastedit';
 						break;
@@ -487,6 +490,9 @@
 	}
 
 	switch ( $sOrderMethod ) {
+		case 'random':
+			$sSqlSort = 'RAND()';
+			break;
 		case 'lastedit':
 			$sSqlSort = 'page_touched';
 			break;

Which adds a new ordermethod named random. Bawolff 02:11, 30 October 2010 (UTC)

I apologize for the slow response (was traveling). I can confirm that the patch works, see the picture slider on my wiki's homepage http://en.qi-hardware.com/wiki/Main_Page I haven't seen it changing pictures due to cache expiration yet, but if I just edit the page then save, it does shuffle the pictures. I will watch whether I notice shuffling after cache expiration as well. I would propose inclusion of this patch in the SVN version. Thanks a lot for the RAND() hint, that was exactly what I had in mind but would have had a hard time coming up with... --Wolfgang 13:50, 11 November 2010 (JST)
Addendum: Randomization after cache expiration works as well. --Wolfgang 11:17, 15 November 2010 (JST)

Request: Sidebar format

Would be quite useful to have an option to output in sidebar format. This could set up generated sidebar menus based on a category.

Return to "DynamicPageList/Archive 02" page.