Extension talk:DynamicPageList (Wikimedia)/LQT Archive 1

Bug report - Lbirn
Really a very powerful extension. Congratulations!

When using the extension, I got the following notice:

Notice: Undefined variable: output in c:\programme\easyphp1-8\www\devwikitest\extensions\intersection\DynamicPageList.php on line 358

Any ideas what the problem could be?

The page however is rendered correctly.

--Lbirn 12:12, 20 July 2005 (UTC)


 * I think you must be using some different version of PHP than what I am using, or PHP with different options enabled. Insert the following in the extension before line 358:

$output = '';


 * This should solve your problem. -- IlyaHaykinson 04:55, 26 July 2005 (UTC)

Checked it with beta 4. Now everything looks fine.

--Lbirn 15:19, 2 August 2005 (UTC)

Feature request - anon 85.65.58.25
How can I order them alphabetic?

Add these lines after #196: case 'alphabetical': $sOrderMethod = 'alphabetical'; break;

Add these lines after #341: else if ('alphabetical' == $sOrderMethod) $sSqlWhere .= ' ORDER BY page_title ';

Rob.desbois 13:06, 5 July 2006 (UTC)


 * Does not seem to work for me. Anyone got an idea why? --Democritus

Bug report - anon 82.72.14.35
I'm getting this error:


 * A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:


 * SELECT page_namespace, page_title, c1.cl_timestamp FROM `page` INNER JOIN `categorylinks` AS c1 ON page_id = c1.cl_from AND c1.cl_to='Rumors' WHERE 1=1 AND page_is_redirect = 0 ORDER BY c1.cl_timestamp DESC LIMIT 5


 * from within function "". MySQL returned error "1146: Table 'wiki.page' doesn't exist (localhost)".

The table "page" does not exist as the error suggests. I've download the .php file and placed it in /extensions/intersection and I've included it in LocalSettings. I am running MediaWiki 1.4.7 -EOM

The bug is gone in the latest version of DynamicPageList for MediaWiki 1.4.6. The version is not linked to on the main page I believe but can be downloaded from the user page of the author.


 * User:Amgine/DynamicPageList 1.5 for MW 1.4.6 is a cheap hack to get most of the functionality of DPL with the 1.4x versions of Mediawiki. It has not been thoroughly tested, so it may perform erratically. I will try to respond to bug reports for that here, but you should preface your report by saying which version you are using. (IlyaHaykinson is the primary developer of the DPL, and I'm just a dabbler trying to use it on an older installation...) - Amgine 18:34, 9 August 2005 (UTC)

Categoryadd problem
I have a problem with the categoryadd parameter. The problem is, sorting by categoryadd makes no difference to sorting by lastedit. This is because every edit to a page causes the categorytimestamp to be updated as well. Is this a bug in MediaWiki?


 * I'm not entirely sure that Categoryadd is supported in Mediawiki 1.4.x. I'm checking this now. - Amgine 18:36, 9 August 2005 (UTC)
 * As well as I am able to test, it appears the 1.4.x version is now able to support the ordermethod feature. Hope this solves your issue! - Amgine 21:57, 9 August 2005 (UTC)


 * I discoverd the the SQL Query doesn't select page_touched at all, so it shouldn't be possible at all to use lastedit as sort parameter. Or am I wrong here? fabian PS: I've fixed that in my hack above!

Request: ordermethod
Basically the reverse of the existing methods.. add in two new methods:


 * categoryadd2 — outputs list based on most distant addition to the first category
 * lastedit2 — outputs list based on most distant edit to the pages

Say I want to display a list of "older" entries, this is how I would do it.

-- Sy / (talk) 22:43, 25 August 2005 (UTC)


 * This basically the reverse of these two order methods. This should be an easy update - let me give it a shot. - Amgine 23:25, 14 September 2005 (UTC)

Request
Is it possible to list pages from a certain category that only links to a certain page? For example page A belongs to catgeory AA. It also links to page B. Page C is also in category AA, but it does not link to page B. I want to have a page D that displays all pages that link to B and is also in category AA. Sorry if this sounds a little confusing.


 * This possible, but is probably outside the scope of this extension. You might try to tinker with it yourself, and see if you can come up with a solution. If you do, please post here! - Amgine 23:30, 14 September 2005 (UTC)

question (Feature request)
can we make a feature, that article are also list, who are in a kind-category. Maybe with the Category-Name in the front or so...--Cyper 13:43, 5 September 2005 (UTC)


 * Cyper: I'm not sure what you're requesting here... Can you explain what you're looking for a bit more? - Amgine 23:22, 14 September 2005 (UTC)


 * I think he would like to have an option, which includes also articles that are in a sub-category of the specified one; for example if you specify the category parameter Category:Communication, that it also outputs pages from the Category:Telephone book. -- mIstA 09:20, 20 October 2005 (UTC)


 * This level category recursion is probably beyond the scope of DynamicPageList. It might be possible to code this, but the number of database queries could grow exponentially and cause the extension to be very costly on the server as well as (potentially) running longer than 30-second default script timeout in PHP. - Amgine / talk meta 18:31, 19 January 2006 (UTC)

Feature request --213.107.105.179 23:03, 14 September 2005 (UTC)
How bout options to allow you to include the date the article was created or the date the article was modified? Having a date for only 'date article was added to category' seems a bit limiting...

--213.107.105.179 23:03, 14 September 2005 (UTC)


 * Currently the extension allows for sorting by the date the article was added to the first category, or by the last modification. I will look into what would be involved in adding sort by date the article was created. - Amgine / talk meta 18:33, 19 January 2006 (UTC)

Agreed with the above request; I'd love to be able to display the time at which each page was last edited (this would allow for a forum-like display in Village Pump-style sections). Thanks for the great script! --Algorithm 11:06, 12 February 2006 (UTC)

Feature request: relative date category filter (for wikinews)
something like:

category=

or

date=0,-1,-2 (today, yesterday, the day before)

69.211.213.120 20:39, 10 October 2005 (UTC) (this is Kevin Baas, not logged in. sorry)


 * Kevin, each site may use a different date category system. On en.Wikinews date categories are Monthname DD, YYYY but another site might use DD Monthname YY and a third use YYYY-MM-DD. The complexity of creating and enforcing a date system is probably beyond the scope of DynamicPageList. - Amgine / talk meta 18:27, 19 January 2006 (UTC)

Topics language
I work in Russian [WikiNews]. I tried for DynamicPageList a category in Russian to specify - so  notcategory=Спорт . It does not work. Must to be all topics - a category, a namespace and other only in English? Thank. 15:37, 20 November 2005 (UTC) Ygrek
 * It definitely works: see n:ru:Участник:IlyaHaykinson/Test -- IlyaHaykinson 06:47, 21 December 2005 (UTC)
 * OK. Thanks. Ygrek 18:54, 4 January 2006 (UTC)

patch for adding first paragraph of article
At User:Svamberg/DynamicPageList_with_first_paragraph is a small patch that is adding first paragraph of an article to printed headline. For example you can visit at this main page.

Actually, we could stand to have a version of this which just includes the whole article (up to a limited size), as it would help in autoagregating briefs on wikinews. Nyarlathotep 18:11, 17 January 2006 (UTC)


 * I'm working on a related script, personally. On the example site, most of the articles being found using this patch version of DynamicPageList follow simple text format, with no leading templates, tables, or images. This works well on this specific site, but might cause problems for sites such as Wikinews which do generally use mediawiki syntax in the leading paragraphs, and usually have a blank line following a leading date template.


 * The model I'm working on is similar to this, with a number_of_paragraphs parameter to allow some sites to use the first two or more paragraphs. The text will be processed through the parser to generate the appropriate html output (to deal with templates and, for example, wiki links.) I will announce here when I get a working model. - Amgine / talk meta 18:46, 19 January 2006 (UTC)


 * Note: it is pretty easy to modify this hack to include and part of the article by manipulating the regular expression. I have several articles for example that follow a similar format. JT 03:23, 24 September 2006 (UTC)

Can DPL's category name be a parameter?
How can make the following work?  category= suppresserrors=true 

 category= suppresserrors=true 

I'm a little confuse that why variables 27 can but can't. Thanks!

-- Chientai


 * Extensions operate outside the main parser and generally can't access circumstantial variables. 27 is a global property, so it can be accessed from anywhere. --Algorithm 22:07, 23 July 2006 (UTC)

category=People category=in category=in
 * I was able to use named parameters in my category filter on scratchpad. It even let me create a combination filter of constant text, PAGENAME and a parameter.
 * &mdash; MrDolomite | Talk 03:28, 1 September 2006 (UTC)

--Petersec 04:35, 22 December 2006 (UTC)

I'd really like to use parameters with the DPL. Anyone know what the status on this is?

Feature Request: CategoryOnly
Add a parameter that limits the results to pages in the specified category (or categories) and no others for example Catonly=stub would show pages in Category:Stub, but not in any other category. 205.210.232.62 20:36, 21 April 2006 (UTC)

Feature request - ordermethod
ordermethod option is an interesting one, but unfortunately, its current shape makes it completely useless for Wikinews. It would be much more convenient to have firstedit value, which would sort news by time of first edit of an article. Generally, you want to know when the news story was written, not what time somebody corrected last spelling error in it. --Derbeth 21:45, 3 July 2006 (UTC)


 * any further developments on this topic? this would be a nice and useful feature for intranet wikis (news sections etc.)!

Feature request - alphabetical
I'm abusing the DPL to dynamically list articles from certain categories. I would prefer If I could sort the resulting list alphabetically. --Democritus
 * This is pretty easy to impliment just add this at line 197:

case 'alpha': $sOrderMethod = 'alpha'; break;
 * Then add this at line 344:

elseif ('alpha' == $sOrderMethod) $sSqlWhere .= ' ORDER BY page_title ';
 * Make sure you sort ascending also. Sorry, I'm not setup on SVN yet, or I'd check this in.


 * I have seen that hack mentioned ab it further up. I got it imeplemented, yet it still doesn't work. And if I add ascending, it gives me SQL errors... any idea? --Democritus



Here is a small patch to make the alphabetical odering work with svn from 2007-02-24 (similar to the patch above). --- DynamicPageList.php 2007-02-24 12:23:14.000000000 +0100 +++ DynamicPageList.php.alphabetical     2007-02-24 12:23:43.000000000 +0100 @@ -194,6 +194,9 @@       case 'lastedit': $sOrderMethod = 'lastedit'; break; +      case 'alphabetical': +        $sOrderMethod = 'alphabetical'; +        break; case 'categoryadd': default: $sOrderMethod = 'categoryadd'; @@ -338,6 +341,8 @@    if ('lastedit' == $sOrderMethod) $sSqlWhere .= ' ORDER BY page_touched '; +   else if ('alphabetical' == $sOrderMethod) +     $sSqlWhere .= ' ORDER BY page_title '; else $sSqlWhere .= ' ORDER BY c1.cl_timestamp ';
 * to apply just save the lines below as DynamicPageList.patch
 * # cd /path/to/DynamicPageList.php && patch -p1 -i /path/to/DynamicPageList.patch
 * set "ordermethod = alphabetical" in your article

Installation question
Hmm, I knew these install steps were too good to be true, at least with my luck :) The DPL neither functions, nor shows up on my Special:Version page (I don't think editing includes\SpecialVersion.php is needed) on IIS in WinXPPro (no jokes, please ;) The MediaWiki software works fine, just no dice on DPL. If there is a better forum for this kind of question, please let me know.  Thx. &mdash; MrDolomite | Talk 07:15, 11 September 2006 (UTC)
 * download http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/intersection/DynamicPageList.php
 * save into the  directory
 * add  to your LocalSettings.php
 * MediaWiki: 1.7.1
 * PHP: 5.1.4 (isapi)
 * MySQL: 5.0.22-community-nt

Nevermind, found a clue over on Extension:DynamicPageList2. I had Read & Write permissions to the extensions directory, but not to the DynamicPageList.php file itself. Once I set those, everything worked great, including automatically appearing on Special:Version. &mdash; MrDolomite | Talk 02:25, 12 September 2006 (UTC)

Languages
I would create other languages sections, using the language links (i.e. es: / fr: and so on).

"addfirstcategorydate" problems?
Hi. Use of this feature leads to strange results. A date that should have been "2006-10-12" showed up as "2006--1-0-" yesterday and, without other changes, as "0 <> 2006" today. See here. NOTE: This is using DPLForum, but the author of that extension told me that he is just piping the result of DPL unchanged here. Any idea? Thanks. -- 217.87.77.229 10:09, 13 October 2006 (UTC)
 * I think it's a wikia problem more than a DPL problem. See the note I left here which has examples that work on meta but don't on scratchpad. &mdash; MrDolomite | Talk 16:39, 13 October 2006 (UTC)

Need help with project
I'm trying to do a Template, but having issues. I'm sure someone here will have some ideas that will help.

the current template code for testing is:  namespace = Main



using the Template like this:

gives me: DynamicPageList: Too few categories!

Any ideas? --Tildar 17:56, 15 January 2007 (UTC)

OK. re-reading this page again shows I've duplicated the "Can DPL's category name be a parameter?" question. Is there any more news/information on this? --66.15.44.242 20:13, 15 January 2007 (UTC)
 * Use Bawolff 06:49, 9 September 2008 (UTC)

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

Some questions
Thanks!
 * 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.
 * --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 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: 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)
 * 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.
 * 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 tag while dynamicpagelist one create a 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 , 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:



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

DPL finds nothing, if, DPL finds it is necessary, but besides a lot of superfluous.

How to make correctly?

Thanks.

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