Extension talk:DynamicPageList2

From mediawiki.org
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).

How about 1.9's?[edit]

Can any one tell me how to upgrade DynamicPageList2 to fit MW 1.9. I just upgraded it from 1.5 to 1.9, and find the category things not work any more. I only find:

0.8.0 and above, you have to install the Labeled Section Transclusion extension too (both lst.php and lsth.php files).

For v0.7.0 and above, if you want to apply the 'category' parameter on the Uncategorized pages, you are required to execute this manual query on your MediaWiki database, replacing prefix with your prefix if any:

CREATE VIEW prefix_dpl_clview AS 
 SELECT IFNULL(cl_from, page_id) AS cl_from, IFNULL(cl_to, '') AS cl_to, cl_sortkey 
  FROM prefix_page LEFT OUTER JOIN prefix_categorylinks ON page_id=cl_from

And I think I should execute the mysql query on my database. I used no prefix, so I remove all the "prefix" in the syntax, but I got the following error message:

SQL query: 

CREATE VIEW dpl_clview AS SELECT IFNULL( cl_from, page_id ) AS cl_from, IFNULL( cl_to,  '' ) AS cl_to, cl_sortkey
FROM page
LEFT OUTER JOIN categorylinks ON page_id = cl_from

MySQL said: 

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VIEW dpl_clview AS 
SELECT IFNULL(cl_from, page_id) AS cl_from, IFNULL(cl_to, '' at line 1 

Can someone tell me what to do?

The reason is that MYSQL 4.x does not understand the "CREATE VIEW" statement. You must use 5.0.1 or later.
Regarding DPL2 and Mediawiki nothing has changed with version 1.9.
Algorithmix 08:42, 18 February 2007 (UTC)Reply[reply]

General ToDo list[edit]

This section is for DPL2-related tasks that are neither feature requests nor bug reports.

For feature requests, see Talk:DynamicPageList2#Feature_Requests.

For bug reports, see Talk:DynamicPageList2#Bug_Reports.

Contributions are welcome!

  1. Test DPL2 with file caching on MediaWiki 1.8 #File_Cache_Issue
  2. Comment functions in phpDocumentor format.
  3. Test on non-english wikis to check whether links to category/special pages rendered properly.
  4. Add a DPL id to identify the DPL tag that generates a particular debug message, in case of multiple DPLs in the page.

Current Status/ETA: 0.8.1 just released with article fetching

Roadmarks[edit]

  1. Instead of just enumerating the title with the link, just include the whole articles found. See DynamicPageList2#includepage
  2. Tag SVN versions for the different releases (e.g. REL_0_5_0) (create a tags directory on the SVN repository somewhere). See DynamicPageList2#Source_and_Installation.
  3. Refactoring: create a DynamicPageList2 class for more structured code and have $aArticles, local parser, etc. as private members. Done in 0.7.8.

Bug Reports[edit]

How to report a bug[edit]

See Bug report.

Old Fixed/Closed Bugs[edit]

Old Open bugs (TO BE REPORTED ON MediaZilla?)[edit]

Title or something like this[edit]

Hello! I would appreciate a bit of help, but I do not think this could be done. I would like to use this function with an "if" template but it does not work. I would like to add a title before the list but only if there are articles in the category. I though that with something like this would work:

{{#if:<DynamicPageList>
namespace=0
category=65655
count=8
</DynamicPageList>|
'''Title'''
<DynamicPageList>
suppresserrors=true
category=category name
count=10
</DynamicPageList>}}

However, it does not. I have tried with all kind of "if" functions. I have tried {{#if:}}, {{qif}} with {{#ifeq:}}, with {{#switch:}} and with {{switch}}. I have tried writing the "suppresserrors=false" and then saying that it should be equal to "DynamicPageList: No results!". Nothing has worked and therefore the problem is in this code, not in the if functions. Is there any way to fix that? If the answer is no, would it be possible to add a parameter such as "title" that would add a text before the list (in this case, the text would be "===Title===") if there are articles in the category?--SMP (talk page) 08:53, 26 June 2006 (UTC)Reply[reply]

I tried a very simple example (using v0.6.3) with the output I got on the right:
Input Output
'''Without if function:'''

Teststart...<DPL>
debug=0
count=0</DPL>...Testend.

'''With if function:'''

Teststart...{{#if:<DPL>
debug=0
count=0</DPL>
|NOTEMPTY?!}}...Testend.

Without if function:

Teststart......Testend.

With if function:

Teststart...NOTEMPTY?!...Testend.

So obviously something wrong happens in the if parser function, not in the DPL. I did some very basic debugging on ParserFunctions.php (code for parser functions): I printed the test variable when the ifHook function is called (just insert a print($test)) and got �UNIQ7fa446a58acad8f-DPL-5139857e4e92869200000002-QINU, which is not good and obviously not an empty string. My guess is something wrong is happening in the mediawiki code with hook, parsing and stuff, "and stuff" meaning that I did not do enough digging to be more exact and to solve the problem. So my question is: have you been able to use the parser functions (if or ifeq at least) with another parser extension (using tags like DPL) than the DynamicPageList2? This would help. --Dangerville 18:11, 3 September 2006 (UTC)Reply[reply]

File Caching breaks the dynamic side[edit]

  1. DPG2 doesn't work with caching!

"$wgUseFileCache = true;" - So I need to click edit and change the content a very little bit to update the DPG listing!

Could you find a way to create a stop cache value in DPG2 or look into making some kind of __NOCACHE__ magic word?

This is no longer the place to report bugs. Please read Bug report and specify which MW version you are running.
check out NoCache It seems to work but I'll test it out!

Feature Requests[edit]

I will not have time to work on DPL the next time, so if you have a few days to spare and fix some of the issues below, I would be glad and include your code! Thanks. Unendlich 16:49, 13 May 2006 (UTC)Reply[reply]

Contributions are welcome!

Open[edit]

Request a feature here. Requests with patch attached are more likely to be processed first. Add ~~~~ at the end of the request to know when it has been requested (and who if possible).

Below is a list of features not requested by users yet, but that the developers thought of. This list is just for memory. If you are interested in one of these, please create a subsection for your feature request after this list.

  1. Ordermethod='category, categoryadd'
  2. Make addpagetoucheddate, addeditdate, adduser, addcategories available in 'mode=category'.
  3. Different colors for different types of debug messages (e.g. red for errors)
  4. Generate TOC based on headings with 'headingmode=H2|H3|H4'.
  5. Make 'hitemattr' param applicable to 'none', 'definition', 'H2', 'H3', 'H4' headingmodes; 'hlistattr' applicable to 'none' headingmode; 'itemattr' and 'listattr' applicable to 'mode=category'.
  6. Add an option to have the times, usernames, etc. appended to the page name i.e. Random_Page - Sam 09:17 Wed Sep 6... See adduser for usernames; for dates, addpagetoucheddate, addeditdate, addfirstcategorydate, etc., for times, see Display time of pagetouched.
  7. Add option to continue static HTML list (not start a new one). Example:
<ol>
  <li>Item1</li>
  <li>Item2</li>
  <DPL>
   ...
   mode=ordered
   ...
  </DPL>
  <li>Item n</li>
</ol>

Category Cloud[edit]

Is it possible to implement some sort of font changing system where the output with the most results could be given a bigger font like the PirateBay Search Cloud

Thanks

Mark Waters 12:51, 8 January 2007 (UTC)Reply[reply]

This is available since version 0.9 -- Algorithmix 11:25, 17 February 2007 (UTC)Reply[reply]

Yes, but how is it executed? And can it also work with actual content words, instead of categories only? Thanks!

Count n,n[edit]

Syntax: count=n, with n a positive integer

I'm waiting for the article fetching mod to be completed and because I want to use it with news feeds (small pages based on templates) to list the last 25 news articles.

Article fetching mod available since 0.8.0.

I want to be able to use the same thing for archieving next 25 older stories - eg Syntax: count=n,n (count=26,50)

My mediawiki has file caching and shouldn't cause too much lag when cached :) - 58.84.66.222 18:49, 5 December 2006 (UTC)Reply[reply]

hiding article titles[edit]

I'm using the "Transcluding visual headings" or article fetching and works fine apart from the fact it shows the title as per normal and then displays the actual article under it.

- article title
THE ACTUAL ARTICLE
- article title
THE ACTUAL ARTICLE

Is there a way to remove the normal "DPL2" title listing and simply display the article instead?

The experimental version on my personal discussion page should be able to do this. See "mode=userformat" in the request list below. If you do not specify %PAGE% you will not get any page title. --Algorithmix 20:52, 11 January 2007 (UTC)Reply[reply]
bugzilla:8529
This is resolved with version 0.9, see mode=userformat -- Algorithmix 11:27, 17 February 2007 (UTC)Reply[reply]

Results / No Results Heading[edit]

It would be nice if you could specify a heading to be used for DPL if there are results, and similarly a heading if there are no results. e.g.

 resultsheader= === Results Found! ===
 noresultsheader= === No Results Found! ===
Version 0.9 has that feature. It works exactly as you suggested. --Algorithmix 21:33, 11 January 2007 (UTC)Reply[reply]

date formatting[edit]

addeditdate et al. would be more versatile if they accepted not just "true", but actual date formating as options. e.g.

addeditdate="("F d")"

Would give "(October 23)", per the relatively standard date formatting functions, ParserFunctions and php's date.

The idea in addeditdate=false/true was to rely on the user's preferences or your wiki global settings for the date-time format, to use features of MediaWiki. But yes, more versatility is always welcome. I will look into the ParserFunctions implementation when I get to provide this feature. --Dangerville 19:10, 23 October 2006 (UTC)Reply[reply]

DPL and templates[edit]

I want to put DPL into a template, likeso:

<includeonly>
<DPL>
category=news
category={{{1}}}
count={{{2|5}}}
</DPL>
</includeonly>

or alternatively, use dynamic m:ParserFunctions, likeso:

<DPL>
category={{ #time: F d, Y }}
count=15
</DPL>

In both cases, it would seem as though DPL is not interpreting the variables or expressions. This seems like a rather intuitive use for it; any help would be appreciated. Bmh ca 16:25, 23 October 2006 (UTC)Reply[reply]

Indeed, DPL category param accepts magic words but not templates or template-like constructs like parser functions at the moment (I actually haven't tested these so this may not be exactly true). This will be for a future release. --Dangerville 19:35, 23 October 2006 (UTC) Reply[reply]
It looks as though
DynamicPageList2.php:342 $title = Title::newFromText($localParser->transformMsg($sParam, $pOptions));
is the relevant point of intersection. The comments for
Parser::transformMsg( $text, $options )
indicate that it will only change magic variables (which makes sense, given the options). A call to
Parser::parse( $text, &$title, $options, $linestart = true, $clearState = true, $revid = null )
would seemingly substitute variables appropriately. Hopefully this would be the only line that needs to be changed, but I'm cautious that would be wishful thinking. Bmh ca 20:42, 23 October 2006 (UTC)Reply[reply]
Seems as though this depends on bug 2257; when the patch there is submitted, this should be a trivial fix. Bmh ca 14:55, 24 October 2006 (UTC)Reply[reply]
In fact, the DPL is using the Parser::parse() function as you suggest to parse the 'inlinetext' param value already. But it may be better to wait for the results on the bug 2257 before testing the method on templates in the DPL. Thanks for the tip! --Dangerville 15:18, 9 November 2006 (UTC)Reply[reply]

Note:
All problems mentioned above are resolved in version 0.9. To use DPL with parameter expansion within templates you MUST use the "parser function syntax". That means you have to write something like

<includeonly>{{#dpl:category=news|category={{{1}}}|count={{{2}}}}}</includeonly>
--Algorithmix 21:44, 11 January 2007 (UTC)Reply[reply]

Pardon me, but the latest version on the site is still 0.8.1. Where is this version 0.9 of which you speak? -- Jordan Peacock 17:18, 19 February 2007 (UTC)

You can find DPL 0.9.x on the dpl website. The extension is installed there and you can experiment creating your own test examples. --217.111.20.10 19:58, 19 February 2007 (UTC)Reply[reply]

Page transclusion: format page link/title as "headline" link or customizable link like "read more"[edit]

One additional thing which might be important is to add an additional "mode" parameter to format the pagename/title/link to the complete page, as either a "headline" link, or as a link ("read more.../customizable text") appended at the end of the included text, or maybe both. Yes I know I am asking for a lot, but better take all things into account.

In all cases, keep up the good work - this extension is already greatly expanding the use of categories and namespaces in MW, to make it even more flexible and powerful. --MortenB 23:51, 28 July 2006 (UTC)Reply[reply]

I think this can be achieved with 'mode=userformat' , see below.

This feature uses a symbolic variable (%PAGE%) which becomes replaced by the article name during the generation of the list. Download the special version of DPL2 from my personal discussion page and try something like

{{#dpl:category=your category
|includepage=#a chapter title from the document
|mode=userformat
|listseparators=,\n<br>, [[%PAGE%|read more ..]]
}}

-- Algorithmix 22:23, 11 January 2007 (UTC)Reply[reply]

list subpages[edit]

It would be brilliant if this could be extended to also show dynamic lists of subpages. 193.77.78.187 18:08, 27 November 2005 (UTC)Reply[reply]

Like Special:Prefixindex? pfctdayelise 16:38, 24 August 2006 (UTC)Reply[reply]
For dynamic lists of subpages, Lea_Linux:Listsubpages (derived from ListSubPages) might be of great interest to you. --Dangerville 11:17, 25 August 2006 (UTC)Reply[reply]
  • Here's what I'm using to do this, template away as needed.
On the page where you want sub pages listed...
<DPL>
category={{FULLPAGENAME}}
</DPL>
On each sub page...
[[Category:{{BASEPAGENAME}}]]
Enjoy! — MrDolomite | Talk 17:33, 13 October 2006 (UTC)Reply[reply]

CategoryOnly[edit]

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:32, 21 April 2006 (UTC)Reply[reply]

I think that is what the category parameter does. (SEWilco 18:45, 26 June 2006 (UTC))Reply[reply]
No, I think category will also show pages that are in multiple categories, one of which is Category:stub. pfctdayelise 16:39, 24 August 2006 (UTC)Reply[reply]
There is a new parameter in DPL 0.9 which allows to set a minimum and a maximum for the number of catgeories an article may belong to. Using that parameter (setting the maximum to 1) you can achieve what you want. -- Algorithmix 11:35, 17 February 2007 (UTC)Reply[reply]

Add Format Option for display in sidebar[edit]

Can someone add a format option so the pages can be displayed in a sidebar? I know it can't be too difficult... in the sidebar, I'm thinking you could just put:

* recently updated
<DPL>
 category=somecategory
 ordermethod=lastedit
 sidebar=true
</DPL>

What would be displayed is something like

* recently updated
** wikilink1|title1
** wikilink2|title2

Also there should probably be a "limit number of characters in title to display" option also. Additionally, if there was an option to define the wrapper tags, might be a little more open ended... might get a little complicated then... thanks for the help, guys!

OK. I think we are looking at a new 'mode=sidebar' here. For "limit number of characters in title to display", it's available. See titlemaxlength. Even though I have a rough idea, could you explicit your "option to define the wrapper tags"? Thanks. --Dangerville 16:47, 1 October 2006 (UTC)Reply[reply]
Creating a CSS Menu using DPL2[edit]
I've taken the two previous comments that were here and merged them into one comment for consistency. You can view them using the history function if you really want..
The context of this usage is a corporate intranet where categories act as topic indexes, for example indexes for documentation for clients, so you'd have a category named clientA, another named clientB and so on. Here we use DPL2 to autogenerate an unordered list that we can then use with some simple CSS to make a :hover menu. When an article is added to a category, the menu is dynamically updated - as if by magic.
Browsers that do not support the required CSS or have javascript disabled will just generate a list of the top level links, in the aforementioned context you'd just have a list of categories - no submenus.
Update 27/08/06 - Cleaner, more accessible version:
Update 26/09/06 - Corrected Javascript slightly (now IE wont cry if it doesnt find id="menu", if you're silly enough to leave script debugging on)
Update 01/10/06 - Simplified DPL input
Simply append the following into skins\common\IEfixes.js
// Enable DPL2 Menu

sfHover = function() {
        var dmenu = document.getElementById("dmenu");
        if(!dmenu) return; /* no menu on page */
        var sfEls = dmenu.getElementsByTagName("li");
      	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
Then in MediaWiki:Common.css pop in the following CSS. Update 27/08/06 - Cleaner, more accessible version:
#dmenu, #dmenu ul { /* all lists */
	font-size: 95%;
	padding: 0;
	margin: 0;
	list-style-type: square;
	float : left;
	width : 11em;
}
	
#dmenu li { /* all list items */
	font-size: 95%;
	position : relative;
	line-height : 1.25em;
	margin-bottom : -1px;
	width: 11em;
}
	
#dmenu li ul { /* second-level lists */
	position : absolute;
	left: -999em;
	margin-left : 11.05em;
	margin-top : -1.35em;
}
	
#dmenu li a {
	width: 11em;
	display : block;
	padding : 0 0.5em;
	z-index:10;
}
	
#dmenu li a:hover {
	text-decoration: none; 
	background: #336699; 
	color: #FFFFFF;
}
	
#dmenu li:hover ul, #dmenu li.sfhover ul{
	left: -999em;
}
	
#dmenu li:hover ul, #dmenu li.sfhover ul { /* lists nested under hovered list items */
	left: auto;
}
Your DPL input would be something like this:
<ul id="dmenu">
<li>[[:Category:Client1|Client 1]]<dpl>category=Client1</dpl></li>
<li>[[:Category:Client2|Client 2]]<dpl>category=Client2</dpl></li>
<li>...</li>
</ul>

From v0.7.7, you can do this in one shot (with the '+' to have category headings):

<dpl>
category=+Client1|Client2|Client3...
ordermethod=category,<second param>*
headingmode=unordered
hlistattr= id="dmenu"
mode=unordered
</dpl>

*'<second param>' can be lastedit, firstedit, sortkey, etc. See ordermethod.

Which would generate output like
<ul id="dmenu">
<li>
<a href="/wiki/Category:Client1" title="Category:Client1">Client 1</a>
	<ul>
	<li><a href="/wiki/Client1_Page1" title="Page 1">Page 1</a></li>
	<li><a href="/wiki/Client1_Page2" title="Page 2">Page 2</a></li>
	</ul>
</li>
Now, to figure out how to get this all into the sidebar

--203.167.229.2 05:17, 17 August 2006 (UTC)Reply[reply]

Great! Could you provide a link where we can see that in action? --Dangerville 11:57, 19 August 2006 (UTC)Reply[reply]
The below has not been updated to reflect the updates to the previous bit of discussion
Unfortunately I dont have a publically accessible wiki installation, and I can't post pics of the menu I've got working because of its corporate sensitive nature, but the above is tested and working for IE and Firefox in my sandbox. If someone wants to give this a shot on a publically accessible wiki, feel free to do so and link here
Now, re: the sidebar.
* navigation
** Main Page|Main Page
Becomes
		<div class='portlet' id='p-navigation'>
		<h5>Navigation</h5>
		<div class='pBody'>
			<ul>
				<li id="n-Main-Page"><a href="/wiki/Main_Page">Main Page</a></li>
So change /skins/Monobook.php, about line 166
...
	<script type="<?php $this->text('jsmimetype') ?>"> if (window.isMSIE55) fixalpha(); </script>
	<?php foreach ($this->data['sidebar'] as $bar => $cont) { ?>
	<div class='portlet' id='p-<?php echo htmlspecialchars($bar) ?>'>
		<h5><?php $out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?></h5>
		<div class='pBody'>
!THIS LINE HERE		<ul>
<?php 			foreach($cont as $key => $val) { ?>
				<li id="<?php echo htmlspecialchars($val['id']) ?>"<?php
					if ( $val['active'] ) { ?> class="active" <?php }
				?>><a href="<?php echo htmlspecialchars($val['href']) ?>">
...
To
...
	<script type="<?php $this->text('jsmimetype') ?>"> if (window.isMSIE55) fixalpha(); </script>
	<?php foreach ($this->data['sidebar'] as $bar => $cont) { ?>
	<div class='portlet' id='p-<?php echo htmlspecialchars($bar) ?>'>
		<h5><?php $out = wfMsg( $bar ); if (wfEmptyMsg($bar, $out)) echo $bar; else echo $out; ?></h5>
		<div class='pBody'>
!THIS LINE HERE		<ul id="dmenu">
<?php 			foreach($cont as $key => $val) { ?>
				<li id="<?php echo htmlspecialchars($val['id']) ?>"<?php
					if ( $val['active'] ) { ?> class="active" <?php }
				?>><a href="<?php echo htmlspecialchars($val['href']) ?>">
...


And then change Mediawiki:Common.css (here we simply cascade into the existing .portlet class instead of thrashing about with our own classes)
/* minimum menu requirements for functionality */
.portlet li {
	display:block;
}
.submenuul{
	font-size: 95%;
	line-height: 1.5em;
	position:absolute; 
	display:none;
	border:1px solid #9d9da1; 
	background:#E7F7FF;
}
.submenuli a{
	font-size: 95%;
	line-height: 1.5em;
	display:block; 
	width:180px; 
	z-index:10;
	text-decoration: none;
}
.submenuli a:hover{
	text-decoration: none; 
	background:#336699; 
	color: #FFFFFF;
}

/* lists nested under hovered list items */
li:hover ul , li.over ul{display: block;}

#dmenu li>ul {left: 150px;}

This wont get DPL2 working in the sidebar, but it's a step in the right direction. If you can get DPL2 to parse in the sidebar, then the above should start working :) --203.167.229.2 22:11, 19 August 2006 (UTC)Reply[reply]

Excludetitle?[edit]

Is there a way to exclude one specific page (by title) from the results? This would be useful where DPL is used to insert a list of pages for a category into an individual page in-category, but where there's no need for the page to link to itself. For instance, http://desencyclopedie.org/index.php?title=Liste_des_villages_du_Qu%C3%A9bec&oldid=50340 lists each individual village in the category, but the "list of villages..." page itself needs to be removed from the output.

Do you just want to remove pageX from the results of a DPL if it is on that same pageX (the DPL would do this dynamically, without you specifying the title to remove)? or being able to remove specific pages from the results by specifying titles (pageX or another) with something like an "excludetitle" parameter? or both?! (These are different things with different implementations.) --Dangerville 18:27, 3 September 2006 (UTC)Reply[reply]
Yes, there is such a possibility in DPL 0.9. It is called nottitlematch=... and you can use a SQL like-expression to exclude articles from the result. -- Algorithmix 11:37, 17 February 2007 (UTC)Reply[reply]

mode=count[edit]

I would like to request a new mode type, which would return the resulting article count, instead of the article list. The result should be a single number (zero) even if there are no resulting articles. --jsimlo(talk|cont) 19:46, 10 September 2006 (UTC)Reply[reply]

This is available with version 0.9. Use resultsheader= and %PAGES%. -- Algorithmix 11:41, 17 February 2007 (UTC)Reply[reply]

List Count in Header[edit]

I would like to see an option to include a count of items in the returned list much like the count of articles in a Category, "There are 233 items in this list". John Stanton 18:45, 13 September 2006 (UTC)Reply[reply]

resultsheader= and %PAGES% will do the job. With "headingmode" you can use "headingcount=true" to get a text line after each subheading. -- Algorithmix 11:43, 17 February 2007 (UTC)Reply[reply]
Definitely second this. I've been wanting this functionality since I first found DPL. --Kkragenbrink 23:50, 1 June 2007 (UTC)Reply[reply]

Output gallery[edit]

It would be nice to have the option to output a <gallery> when the namespace is Image. Dori | Talk 00:18, 16 October 2006 (UTC)Reply[reply]

This is possible. You will find an example on the dpl demo site. -- Algorithmix 11:46, 17 February 2007 (UTC)Reply[reply]

Passing DPL as template argument[edit]

I seem to be having trouble passing <DPL>...</DPL> as an argument. Any suggestions on how to do this? e.g.

 {{ TemplateX | <DPL>
 category=x
 </DPL>}}

Thanks! Bmh ca 15:29, 24 October 2006 (UTC)Reply[reply]

This seems to be the same problem as Title or something like this. I don't know better as of now, sorry. --Dangerville 15:27, 9 November 2006 (UTC)Reply[reply]
This is solved in the "#parser function" syntax variant. See below --Algorithmix 22:55, 11 January 2007 (UTC)Reply[reply]

Date and Time[edit]

Using addfirstcategorydate=true

23:10, 10 November 2006: NDSNews:2006-11-10 - Mathomatic ported to the DS (again)

line 1129 "$r .= $wgLang->timeanddate($article->mDate, true) . ': ';"
We can change to $wgLang->date will show
10 November 2006: NDSNews:2006-11-10 - Mathomatic ported to the DS (again)

Should be easy enough to tweak :)

Before v0.7.7, DPL2 was using date() as you suggest, until the feature request "Display time of pagetouched" (closed) required both date and time. So to attempt to make everybody happy, soon, when providing Talk:DynamicPageList2#date_formatting date formatting to DPL2 users, they'll be able to do whatever they want with the date. How does that sound? --Dangerville 17:28, 11 November 2006 (UTC)Reply[reply]


Page transclusion: Possible enhancement[edit]

Possible enhancement (1): Currently labels must be part of the text source of an article itself. It would be nice if the label could be buried within a template. Partly for esthetical reasons and partly as this would allow to easily transclude the contents of template parameters.
Example: You use a template in your articles for, say, year of birth and year of death of people; you use DPL2 to show a list of all people who contributed to xyz (maybe using the linksto=xyz phrase). If the transclusion does not understand templates, you will have to put section markers around the parameters when calling the template in each article. If transclusion can handle templates you will be able to hide the labels in the template.

The idea behind all this is to have a semantically useful summary of related topics in one article so that the user gets a clearer understanding of the relevance of listed (or referencing) articles, especially in combination with the linksto option. Algorithmix 14:52, 15 December 2006 (UTC)Reply[reply]

titlematch = "pattern" : restricting the result to certain articles[edit]

It would be nice to have a name matching pattern for articles we want to see in the result set.

  • titlematch = pattern

should do the job. "pattern" could be a SQL-LIKE expression. So titlematch=a% would match all articles the names of which begin with an "a". An implementation can be found on my homepage.

Algorithmix 20:28, 19 December 2006 (UTC)Reply[reply]

pattern match for categories[edit]

(seems close to the previous topic)

Our wiki's subcategories' names usually starts with the upper categorie's name (for example : DB category includes DB-Oracle and DB-PostgreSQL). I tweaked the code to use ILIKE instead of = in the appropriate request :

DynamicPageList2.php l.786 :

$sSqlSelectFrom .= (...) AND (cl' . $iClTable . '.cl_to = ' . $dbr->addQuotes($aIncludeCategories[$i][0]);

is now

$sSqlSelectFrom .= (...) AND (cl' . $iClTable . '.cl_to ILIKE ' . $dbr->addQuotes($aIncludeCategories[$i][0]);

now I can use category=DB% to match the category and all subcats (works with PostgreSQL as Wiki DB - might also work with MySQL LIKE).

You may want to have a look at http://semeb.com/dpldemo; you fill find a more recent version of DPL which contains a match operator for categories and many more features you couldn´t even think of ;-) 84.188.160.128 20:01, 5 June 2007 (UTC)Reply[reply]

mode=userformat : more flexibility with output formatting[edit]

I suggest to define a new mode called userformat.

In this mode DPL2 will reset all internally pre-configured output tags an give the user full control over the output. We only need a new property (called listseparators) to define the user specific tags to be used.

  mode=userformat
  listseparators=t1,t2,t3,t4

tag1 and tag4 wrap the whole output, tag2 and tag3 wrap each item.

For full flexibility we use a symbol (%PAGE%) to give the precise location where the name of the article (or a link to it) should fit in. All tags should be WIKI style. Because wiki formatting depends on linefeeds (tags like * or # for enumerations only work at the beginning of a line) we need a symbol ('\n') which acts as a linefeed.

Thus we can now write

  mode=userformat
  listseparators=,\n*[[%PAGE%]]

Yes, that´s all you need. The first parameter is empty, the second says that before outputting the page link we should have a linefeed followed by an asterisk. And that is wiki syntax for simple unnumbered lists.

Why all that, you might ask. Have a look at [1]. You will find a demonstration of the flexibility of the proposed feature. The source code can be found on my homepage.

The real power comes when you combine the new page inclusion feature with the flexible formatting proposed here. On my demo page you will find a sortable wikitable which is composed of articles and some selected sections of each article. You can re-arrange the DPL2 output based on article names AND based on the contents of the chapters´ contents! Isn´t that nice?

To achieve this some changes in the code had to be done which mainly affect the point in time when you trigger the recursive parse of the output. See my comments in the source code.

Finally I´d like to give a more ambitious example (in German, please ignore the contents). Here [2] you will find a sortable list of offerings for bridge journeys. The first column links to the page of the agent providing the journey. On this page templates are used to facilitate editing and to create a standardized appearance. As the agent´s name is only relevant in the summary list it is suppressed in the listing within the agent´s home page.

Algorithmix 20:28, 19 December 2006 (UTC)Reply[reply]

using DPL as a parser function: #dpl:[edit]

Currently DPL2 is written as a normal user extension. This means that you have to wrap the dpl2 statements within dpl tags. Besides that mediawiki offers the so-called user functions which are better integrated into the parser. Their advantage is that you can use complete wiki syntax (including #if:) within the parameter calls. So you could use "category={{{1}}} within a template and pass the desired category as a parameter. If you wanted to have more page lists with similar layout you could bury the details of layout settings within such a template.

As it was not too complicated to do I prepared a version of DPL2 which can be used BOTH ways, i.e. with tags and as {{#dpl:parameter=value|parameter=value|...}}. See my homepage. -- Algorithmix 09:11, 8 January 2007 (UTC)Reply[reply]

Simpleton's page transclusion[edit]

I cannot seem to find a way to include the first x number of characters from an article (eg the first sentences followed by "..."). My aim is to give a flavour of the article's content, without having to click through to it. I would like to not have to add additional markup to the articles in the list. Did this feature once exist or am I imagining this?

--Lanma726 03:26, 4 February 2008 (UTC)Reply[reply]

This feature exists in Extension:DynamicPageList but not here in the old version. Algorithmix 20:59, 6 April 2008 (UTC)Reply[reply]

Closed[edit]

Display Text from Articles[edit]

Currently DPL2 displays article names and optionally some page attributes like authors or dates of change. It would be of great value to show also text portions from the articles. This has already been adressed in two requests above, named

  • Include whole article
  • Include first lines of content

My suggestion is to integrate a very nice extension called mw:Labeled Section Transclusion into DPL2. Steve Sanberg offers with LabeledSectionTransclusion a general mechanism of defining labeled sections within an article which can then be included from another article. Sections may overlap. One can even have several text pieces within an article with identical label and in the simplest case the whole article might be defined as exactly one labeled section. On the other hand there may be situations where you want to include exactly one chapter of an article (i.e. the text after a === heading === up to the next heading). In those cases you would not want to put section markers around each paragraph ...

So I did two things:

  • First I made an enhancement to Steve´s extension which allows to transclude a chapter by putting a "#" before the heading name. This is similar to the way you make hypertext references to chapters of an article like [[my article#its first chapter]].

A chapter extends from the line after the heading to the line before the next heading (regardless of its level!) or to the end of the text. This is a very pragmatic definition but simplicity also has its advantages ..

  • Second I put effort in calling Steve´s extension as a subroutine from within DPL2. This is somewhat tricky because you want to expand wiki syntax in the transcluded text.

My combined version of both extensions works very well for my own purposes but I guess it should be thoroughly tested by Cyril (if he wants to adopt it) before being released into DPL2. Meanwhile the source code can be found on my personal discussion page. Maybe both extensions could be merged?

The Suggested new syntax is as follows:

addsection=label,..
used to specify one or more section labels or #chapters for the "transclusion"; if the name starts with a "#" it is assumed to be a heading, otherwise it is understood as a section label.
sectiontext=groupStart,sectionStart,sectionEnd,groupEnd
used to insert layout tags into the output. The inner tags are put around each section, the outer tags are used in addition for the whole bunch of sections.

known bug: Section markers will not be stripped off if they are part of chapter which is transcluded via the "addsection=#chapter" syntax. Maybe this can be fixed but it is a rather strange constellation anyway.

Algorithmix 22:40, 23 November 2006 (UTC)Reply[reply]

Although I haven't tested it, I suspect the bug is because it uses a local parser instance, which doesn't have the LST hooks, and thus doesn't recognize the LST markup. Using the regular parser's recursiveTagParse() method (for a 1.8+ parser) should fix this. -Sanbeg 19:47, 27 November 2006 (UTC)Reply[reply]

Great! Sorry for the big delay. I've just got back into it. I'll review this and at least integrate this into DPL within the next 2/3 days. The "#chapter" feature may wait a little longer because this requires your modified version of Sanbeg's extension a priori. It would be easier for users to use his extension as it is, all the more as there seem to have been some significant changes to it since then. --Dangerville 00:07, 11 December 2006 (UTC)Reply[reply]

I am happy that you included my draft into the head revision of DPL2. As far as I can see you refer to the "standard" version of LabeledSectionTransclusion which is very flexible but urges authors to add special section marker tags to the articles (unless they want to include the whole article). I still feel that inclusion of sections based on their heading (as it found its way into lsth.php quite recently) might be of some value. And beyond that (but that may be hard to do) inclusion of parameter values of templates which the included page uses.
The idea behind all this is to have a semantically useful summary of related topics in one article so that the user gets a clearer understanding of the relevance of listed (or referencing) articles, especially in combination with the linksto option. Algorithmix 14:52, 15 December 2006 (UTC)Reply[reply]
I agree and was intending to take care of it after looking at lsth.php... and now it's done. DPL2 0.8.1 now provides inclusion of sections based on their heading with includepage=#heading, using the main LST function in lsth.php. Moreover, the "known bug" you mentioned has been fixed using Parser::recursiveTagParse() as Steve Sanbeg suggested. As for the inclusion by passing values to template parameters in the page (I'm not quite sure about how to make that simple for DPL2 users), it would be good to make a separate feature request... Thanks for your ideas! and thanks to Sanbeg for his extension. --Dangerville 02:29, 16 December 2006 (UTC)Reply[reply]

Include first lines of content[edit]

It could be a nice feature, if the DPL could include a few lines of text of each page on the list. This would be very useful for semi-automatically created content lists on main pages and portal pages. Some of our content consists of long articles, blog entries and newsposts. In all cases, the titles doesn't precisely give away the content - so it would be nice with some extra information on a dynamic list.

It could be done in several ways :

  • A la search results pages (created semi-automatically)
  • Could be limited to a user-specified number of characters to be included, for each page on the list.
  • Content could be rendered (preferably), or shown wiki-text (as search result pages).
  • Alternatively, a manually entered and tagged subtitle (on the respective pages) could be included (something like <subtitle>This article deals with...</subtitle>).

Otherwise, great work! --MortenB 17:08, 18 July 2006 (UTC)Reply[reply]

The Newest Pages Blog extension offers the kind of summary feature you are looking for, using a newestpagesblog-summaryendmarker (cf. readme). Have you found a similar feature in another extension or elsewhere (with the source)? If not, I (or others welcome) intend to integrate/adapt their solution (in)to DPL2. Sounds reasonable. --Dangerville 06:51, 24 July 2006 (UTC)Reply[reply]
Thanks for the tip :-) - Sounds interesting; I will check it out right away. I have been through most of the extensions listed on this site and haven't found anything else yet which comes close. I'll get back to you here, if I find other extensions, which might be useful to look at.
However, the DPL could perhaps *simply* make use of the template mechanisms and <noinclude></noinclude> tags already in place in MW? What I am thinking, is that if DPL allow an option to be set in the dynamic list to include the complete article in the list, the user could simply specify what parts of pages to include and what not to. This would make brilliantly possible the kind of dynamic lists I look for to make our front page almost completely automatically updated. This would also provide the ultimate freedom to include on lists what you wanted from specific pages. It should be a perfectly optional setting in a DPL, which by default should be off. Of course, possibly the best user-friendly solution would be one not requiring users to enter tags at all on their newsposts (requiring some kind of specified character count only in the DPL, which is used if no tags are set).
I'm not sure if this goes too far beyond the intention of this extension, or it belongs in an extension of its own. Clearly too much "checking content" of listed pages, will slow the extension down somewhat. --MortenB 12:26, 25 July 2006 (UTC)Reply[reply]
I've looked at the Newest Pages Blog extension, and it sure does things along the lines I try to describe above, if only in a slightly less flexible way than the DPL... I'll try it out. However, it sure would be great to include this kind of functionality, if possible, into the DPL, as the functionality seems much more flexible with this approach. --MortenB 16:18, 25 July 2006 (UTC)Reply[reply]
I read too fast the first time. It is much more an excerpt feature than summary, which means that your idea of using special tags for text to be included in the list is more appropriate (much more flexible) than the summary solution of the Newest Pages Blog extension. So relying on a special tag like <noinclude> (or <includeonly>?) sounds good. In any case, as you suggested, this should be combined with a user-specified DPL2 parameter that sets the max number of characters to be included, in case:
  1. the special tag (e.g. <noinclude>) is not used in the page at all;
  2. special tag is used but too too much text (really) included with that.
Last, if special tag is used more than once in same page, DPL2 would include text from the first chunk only. --Dangerville 07:12, 26 July 2006 (UTC)Reply[reply]
Sounds brilliant :-) - With this functionality it could be used for either - a list of pages with a short summary/subtitle, or inclusion on the list of an excerpt or the near complete page.
This is possible with includepage=subtitle (resp. includepage=summary, whatever you prefer) and using sections labeled 'subtitle' (resp. 'summary') in your articles, since v0.8.0.

Include whole article[edit]

Instead of just enumerating the title with the link, just include the whole articles found. This could be used for a news area where the articles are short. Short but very helpful.

For example:

 <DPL>
 namespace=News
 includeWholeArticle=True
 </DPL>

would result in something like:

 {{:News:news topic 1}}
 {{:News:news topic 2}}
 {{:News:news topic 3}}
 {{:News:news topic 4}}

I think what i did in the example above was page inclution, which i also think can only do one insert. Use whatever is necessary, mine's just an example anyway.

--(Jami)58.69.5.85 04:38, 23 August 2006 (UTC)Reply[reply]

I think Jami means page transclusion. Yes, I was just coming to request the same thing. :) I hope it should be an easy change - from [[ ]] to {{ }} somewhere, right? :) Any tips??? pfctdayelise 16:36, 24 August 2006 (UTC)Reply[reply]
I haven't looked at how to implement this feature yet, but in the meantime, (for people willing to look at the code...) if you could point out the MediaWiki function that handles page transclusion (or the closest to it) or, if not, how MediaWiki does it, it would make the job much easier. --Dangerville 11:09, 25 August 2006 (UTC)Reply[reply]
Just use curly brackets instead of square brackets. e.g. to link to a page: [[page]] To transclude it: {{page}} Like template syntax. pfctdayelise 11:17, 25 August 2006 (UTC)Reply[reply]
Thanks... I got that and Jami's example is quite explicit. But extensions can return HTML code only, not wiki text. Therefore, it is more interesting to find how MediaWiki generates the HTML for transclusion and imitate for the DPL. Of course, as a last resort, I can use your solution - easy - that consists to parse {{page}} and let the wiki parser generate the HTML in return. But this is not optimal. There is usually a more 'direct' way. Again, I haven't looked at it yet... --Dangerville 11:09, 25 August 2006 (UTC)Reply[reply]
I've been searching for this exact feature.. the extention is great and would allow me to make news management VERY VERY simple.. any word on this? worth contacting the developer? - 58.84.65.228 18:31, 15 October 2006 (UTC)Reply[reply]
Yes, I am aware of it. After I am done with the 'ordermethod=hot/popular' feature request, this feature should be the next one on the list. Hint (for those who can't wait any longer...): the method fetchTemplate of the Parser class might help do the business. But this is just at first sight, I haven't done much digging into it yet. --Dangerville 23:23, 20 October 2006 (UTC)Reply[reply]
I don't think it's possible to get the edit section links right from a tag, since they are applied to the HTML. So they would tend to point to sections in the source document. -Sanbeg 19:47, 6 December 2006 (UTC)Reply[reply]
I've just seen that you've worked out a solution for transclusion of content from pages! Great work! Looking forward to trying it out if I can run this :-) (still wishing my webhost would upgrade their MySQL soon). --MortenB 23:49, 14 December 2006 (UTC)Reply[reply]

Most popular article[edit]

I should be fine if we have the same features has [[[m:Dynamic Article List|Dynamic_Article_List]], i means the possibility to have an ordermethod by hit count:

ordermethod=hot
addHitCount=true|false

Thx Christophe

This is now available in v0.7.8 with 'addpagecounter=true' / 'ordermethod=counter'. --Dangerville 23:09, 10 November 2006 (UTC)Reply[reply]

I have update to v0.7.8 but nothing is display. it's the same thing for addeditdate=true or adduser. I try to add debug information but i don't know where le debig info is displayed. Thx Christophe

ORIGINAL creation date only order method[edit]

I run this setup

<DPL>
count=25
shownamespace=false
category=Wiki News
order=descending
ordermethod=categoryadd
addfirstcategorydate=true
</DPL>

and the issue is.. this seems to include edits aswell!!

I want something very simple.. a list with the items from "Category:Wiki News" listed in order of ORIGINAL creation date..
I do NOT want the news page re-ordered if I make a typo and correct it.
This seems pretty simple and Id expect it to be so..

Minor update doesn't work under this setting or Id be using that to fix my problem!

Well, in your example, you are using "ordermethod=categoryadd". This will sort them by date the article has been added to the category "Wiki News" (by looking at the cl_timestamp field in the categorylinks table and nothing more). If you want the pages sorted by date of creation, use ordermethod=firstedit (more info) because the original creation date is the date of first edit in mediawiki, or rigorously speaking, the rev_timestamp of the first revision entry in the revisions table (which is what ordermethod=firstedit is using). --Dangerville 19:46, 23 October 2006 (UTC)Reply[reply]
Perfect, Thank you very much - Hightly anticipating the Article Fetching method :D - 58.84.78.14 09:55, 24 October 2006 (UTC)Reply[reply]

Select Subcategories to be listed[edit]

example: <DPL> category=Hauptkategorie list=subcategories {"subcategories"|"pages"|"both"} </DPL>

By default, you'll get both (subcategories and pages). With namespace=Category, you get subcategories only. With notnamespace=Category, you get pages only. --Dangerville 15:28, 1 October 2006 (UTC)Reply[reply]

sortkey from category tags[edit]

Ordermethod should also include sortkey (from category tags), so that the ordering can be customized. 193.77.78.187 18:08, 27 November 2005 (UTC)Reply[reply]

Available since v0.7.7 with 'ordermethod=category,sortkey' (replacing 'category,title'). --Dangerville 15:28, 1 October 2006 (UTC)Reply[reply]

Do not set a category[edit]

It shoulb be fine to have an option to display all articles from all categories if we have set a namespace. For example if we have set a namespace ant not a category, we display article from all categories from this namespace. Thx Christophe

I believe this already works. You have to specify at least one namespace or at least one category. --jsimlo 14:02, 21 July 2006 (UTC)Reply[reply]
Yes, this was true of v0.5.1. In v0.6, no more such restriction, you can use the DPL with no specified category/namespace. This is allowed(!): <DPL></DPL>; or the ultimate: <DPL/>. --Dangerville 23:30, 18 August 2006 (UTC)Reply[reply]

OK, it sorts fine with release v0.5.1 for the first case, but not for the second. --Ctof 10:17, 25 July 2006 (UTC) Case OK:Reply[reply]

<DPL>
ordermethod=lastedit
namespace=Java
adduser=true
</DPL>

Case KO:

<DPL>
ordermethod=pagetouched 
namespace=Java
adduser=true
</DPL>
Indeed, in v0.6, the DPL will give you an explicit (hopefully) error message. As explained in DynamicPageList2#adduser, you can't use 'adduser=true' with 'ordermethod=...,pagetouched' (... means whatever - including nothing - before pagetouched). Reason: there is no strict relation between pagetouched (field in the page table) and the users' revisions (revision table) in the database. See also comment on ordermethod=pagetouched and Page table for the description of the pagetouched field (not only related to a specific user edit). In this case, you would rather use lastedit:
<DPL>
ordermethod=lastedit
namespace=Java
adduser=true
</DPL>
I hope it helps. --Dangerville 10:37, 19 August 2006 (UTC)Reply[reply]

another point is useradd, *date* do not display anything after the title article. PS: i use Mediawiki 1.7.1

Could you give an example? --Dangerville 10:37, 19 August 2006 (UTC)Reply[reply]
...?? OK, it's been a while, I consider this is solved for you. --Dangerville 15:28, 1 October 2006 (UTC)Reply[reply]

Display time of pagetouched[edit]

For purpose of a group (projectwise working) keeping pages up to date with a certain category, it would be nice if in the list not only the date of pagetouched could appear, but also the time. In that case everybody in our projectgroup can see the last changes in a certain category, even within the same date...

Unfortunately I've just tried to build the first line of PHP in my whole life and that bad line of code looks like this in the function DPL2OutputListStyle:

Original line at row 819 in the source:

$r .=  $wgLang->date($aAddDates[$i]) . ': ';


Very bad example of my wish:
$r .=  $wgLang->date($aAddDates[$i]) . ' ' . substr( '0'.( substr($aAddDates[$i],8,2) + 2 ),-2) . ':'.substr($aAddDates[$i],10,2).' : ';

Sorry about the hard coded output, but that's my starting knowledge of about searching 2 hours in PHP documentation on different sites... The addition in the hour output (substr(....,8,2)) is the time difference, which should come from the "preferences" in Mediawiki, but due to my low knowledge I've hard coded it in this example.

I appreciate the effort. You can just use mediawiki date/time functions, it will spare you some sweating. The date function is coded in languages/Languages.php (see MediaWiki source). There, you will also find what you need, in particular the timeanddate function that shows time and date, using preferences or not (depending on args). The best way to start is to look there (the comments are very helpful). Now, we have to think of how to provide the feature to DPL users, if they want just dates, or times and dates (what do we do with the add*date params)... --Dangerville 18:54, 3 September 2006 (UTC)Reply[reply]
Since v0.7.7, you can get the time (and date) according to your mediawiki config or the user's preferences if logged in. --Dangerville 15:28, 1 October 2006 (UTC)Reply[reply]

linksto=article[edit]

I added some code to use DPL2 for the creation of a list of articles which link to a certain page AND which belong to a certain category. This would allow to produce inverted lists which are semantically meaningful. For instance, you could easily create a list of articles which are in category "poet" and which link to, say Dublin.

Here is a source code diff to the latest version of DPL2:

110a111,116
> 	 * this parameter restricts the output to articles which contain a reference to the specified page.
> 	 * the special value "HERE" stands for the current page
> 	 * Examples:   linksto=my article   ,  linksto=Template:my template   ,  linksto = HERE
> 	 */
> 	'linksto' => array('default' => ''),
> 	/**
231a238
> 	$sLinksTo = $wgDPL2Options['linksto']['default'];
424a432,436
> 			case 'linksto':
> 				$sLinksTo = $sArg;
> 				if ($sLinksTo == "HERE")
> 					$sLinksTo = $parser->getTitle()->mDbkeyform;
> 				break;
459c471
< 	if ( $iTotalCatCount == 0 && empty($aNamespaces) )
---
> 	if ( $iTotalCatCount == 0 && empty($aNamespaces) && (!$sLinksTo) )
537a550,551
> 	$sSqlPageLinkTable = '';
> 	$sSqlCond_PageLink = '';	
579a594,599
> 	if ($sLinksTo != '') {
> 		$sSqlPageLinkTable = ', pagelinks as pl';
> 		$sSqlCond_PageLink = 'pl.pl_from = page_id'
> 							.' AND pl.pl_namespace='.Title::newFromText($sLinksTo)->mNamespace 
> 							.' AND pl.pl_title=\''.Title::newFromText($sLinksTo)->mDbkeyform.'\' ';
> 	}
599c619,625
< 	$sSqlWhere = ' WHERE 1=1 ';
---
> 	
> 	// check LINKSTO condition
> 	if ($sLinksTo == '')
> 		$sSqlWhere = ' WHERE 1=1 ';
> 	else
> 		$sSqlWhere = $sSqlPageLinkTable . ' WHERE ' . $sSqlCond_PageLink;
> 		

A small change in the warning texts would also belong to this change:

 	'dpl2_debug_' . DPL2_WARN_NOINCLUDEDCATSORNS => "WARNING: It is strongly recommended to either limit the number of results with the 'count' parameter or include at least one category / namespace or use the 'linksto' parameter. If not, the generation of the page list can be quite resource and time-consuming.",

I would be glad to see this new feature find its way into the official version. How do you think about it, Dangerville?

-- Algorithmix 11:25, 17 September 2006 (UTC)Reply[reply]

This is now available in v0.7.7. One change that is worth being noticed: instead of HERE, use the magic word {{FULLPAGENAME}} to get pages linking to the current page. You can use all magic words that your MediaWiki supports. --Dangerville 15:28, 1 October 2006 (UTC)Reply[reply]

Category value for Uncategorized pages[edit]

Also a special 'category=nocat' category would be nice, i.e. all new pages or edits for pages which have not been assigned to any category. That would be useful for site administrators and pedants everywhere :) --193.60.81.207 19:42, 11 November 2005 (UTC)Reply[reply]

This is a pretty good idea! It would be useful for me too. --RaZorEdge 18:57, 14 August 2006 (UTC)Reply[reply]
That already exists, it's called Special:Uncategorizedpages. pfctdayelise 16:38, 24 August 2006 (UTC)Reply[reply]
Unlike Special:Uncategorizedpages, this feature aims to combine all the other DPL features with it, like restrict by namespace or all the fancy display options. This feature is now available in v0.7.0. (You have an extra step in the installation.) --Dangerville 16:56, 17 September 2006 (UTC)Reply[reply]

Supress 'minor' edits...[edit]

There should be an option (prolly the default) to ignore page updates which are minor. I.e. they should not get pushed up onto the top of recently edited pages in the DPL. Setting something like 'minoredit=TRUE' would restore the current behaviour.

This is now available in 0.6.4 with the 'minoredits' parameter. --Dangerville 18:58, 11 September 2006 (UTC)Reply[reply]
The problem is that using 'minoredits' parameter excludes such articles from the list completely, which should not be the case. To me the functionality is faulty, and this should be fixed.

Limit number of characters[edit]

Doubt this will make it, but on my wiki I have a few pages with long titles. On my Main_Page I have a list off to the side that displays the last edited in certain categories. Well, I would really like to have it show the first X number of characters then just add some ... after it or something.

This is now available in v0.6.3. See titlemaxlength parameter. --Dangerville 15:36, 3 September 2006 (UTC)Reply[reply]

inline format, items italic or bold[edit]

I prefer ( cat1 • cat2 • ...) and if not already the case, the ability to have the items in bold or italic. (Kevin Baas) 69.211.213.120 21:02, 10 October 2005 (UTC)Reply[reply]

Your example ( cat1 • cat2 • ...) is confusing. Do you mean ( page1 • page2 • ...)? In this case, it is available since v0.3.3 with 'ordermethod=inline'.
For items italic or bold, it is now available in v0.6.2. Use itemattr= style="font-style: italic;" for italic, itemattr= style="font-weight: bold;" for bold, or add a custom class to one of the Mediawiki CSS files and use the class attribute accordingly. --Dangerville 18:25, 29 August 2006 (UTC)Reply[reply]

Having a space in inlinesymbol argument[edit]

Since the inline mode of my own extension, Sort2, was inspired by the same mode of DPL, I though I let you know that I have overcome the no-spaces limitation by introducing a pseudo-entity &sp; which is used by the extension to create a space where the users wants it.

DPL automaticaly creates surrounding spaces for the inlinesymbol argument and therefore makes typographicaly "normal" looking lists impossible.

I'd vote for having the default set to " - " and if an inlinesymbol argument is given, it would be rendered as given without any spaces. If a space is needed, the above mentioned pseudo-entity should be used.

For those curious to test this, please patch the source (hack 0.6) as follows:

Change line 870 from:
$this->sEndItem = ' ' . $inlinesymbol . ' ';

to:
$this->sEndItem = str_ireplace("&sp;"," ",$inlinesymbol);

I've tested it in my own environment and it works just fine. So if there's agreement about usefulness, why not incorporate it in Hack 0.6.1 ;)

Thanks for creating such a nice extension, BTW.

--Kaeptn00 16:17, 20 August 2006 (UTC)Reply[reply]

Indeed. This comment suggested a feature of v0.6.1, but with a larger objective: 'inlinesymbol' is replaced by 'inlinetext' which takes any wiki text. In particular, if you want spaces, use '&nbsp;' as much as needed like in wiki or HTML. (No need of something new in that case.) --Dangerville 14:26, 24 August 2006 (UTC)Reply[reply]

All namespaces, All categories[edit]

Is it really necessary to have You need to include at least one category or specify a namespace! error message? The number of returned articles is limited anyway. And in small wikis, there may be a good reason to list all recently modified articles, e.g. for an export list:

<DynamicPageList>
ordermethod=lastedit
addeditdate=true
order=descending
</DynamicPageList>

--jsimlo 14:02, 21 July 2006 (UTC)Reply[reply]

In v0.6, this is now allowed and does not generate an error, you just get a warning that you can suppress with debug=1 (quiet mode, no warning). Reason for a warning: with no specified category or namespace, you can get ALL the pages on your mediawiki (in the order specified), which includes more than 1400 pages created by default with the installation of MediaWiki (most of which are in the MediaWiki namespace I believe). This may be quite resource-consuming. But true is this is up to the user to decide. --Dangerville 23:22, 18 August 2006 (UTC)Reply[reply]

Group by user[edit]

This extension is almost what is being requested at en:Wikipedia:Administrators' noticeboard#image deletion, except that it also needs to be able to group by the user who created the article. You could have a parameter groupby=creator|lasteditor|categoryadder. Instead of grouping, it would probably be enough to add these as additional values for ordermethod, perhaps allowing a sub-order as well. Bovlb 07:20, 20 September 2005 (UTC)Reply[reply]

As of now, I'm afraid MediaWiki does not allow any reliable way to get the user that creates a specific category link in a page, if there is any. I guess some changes in the core of MediaWiki would be necessary, so something like 'groupby=categoryadder' - as you suggest - goes beyond the scope of this extension. More info on http://mail.wikipedia.org/pipermail/wikitech-l/2006-July/037120.html. --Dangerville 07:11, 24 July 2006 (UTC)Reply[reply]
As for your suggestion of a 'groupby=creator|lasteditor', this is now provided in v0.6 with 'ordermethod=user,firstedit' and 'ordermethod=user,lastedit' (more info). --Dangerville 22:55, 18 August 2006 (UTC)Reply[reply]

notnamespace[edit]

Is there a chance to add a notnamespace parameter? I have already added the code to my own copy of DPL2, but i have no access to the svn to contribute there.

If you want SVN commit access, contact Brion Vibber and read Subversion

Preparations:

    $aNamespaces         = array();
    $aExcludeNamespaces  = array();

Parsing parameters:

            case 'namespace':
            ... ...
            case 'notnamespace':
                $sArg=trim($sArg);
                $sNS = $wgContLang->getNsIndex($sArg);
                if ( $sNS != NULL )
                    $aExcludeNamespaces[] = $sNS;
                elseif (intval($sArg)>=0)
                    $aExcludeNamespaces[] = intval($sArg);
                break;

Building query:

    // Namespace IS ...
    ... ...
    // Namespace IS NOT ...
    if ( !empty($aExcludeNamespaces)) {
        $sSqlWhere .= ' AND (page_namespace NOT IN ( ' . implode (",", $aExcludeNamespaces) . ' ) ) ';
    }

There may be some other things around that i have forgotten, but this works for me... afaik -- jsimlo 16:38, 1 July 2006 (UTC)Reply[reply]

Feature now available (using your code + small change to error handling so that notnamespace param can be used alone) in v0.5.1. Thanks. --Dangerville 02:54, 16 July 2006 (UTC)Reply[reply]

Date and Time[edit]

Using addfirstcategorydate=true

23:10, 10 November 2006: NDSNews:2006-11-10 - Mathomatic ported to the DS (again)

line 1129 "$r .= $wgLang->timeanddate($article->mDate, true) . ': ';"
We can change to $wgLang->date will show
10 November 2006: NDSNews:2006-11-10 - Mathomatic ported to the DS (again)

Should be easy enough to tweak :)

Page browse[edit]

Allow pages so that even with a limit on the number of articles displayed, users may click to go to the next page. This is most easily accomplished by including an "offset" attribute. However, it is probably best accomplished with a dynamic offset such that the same page can handle many different offsets which are inputted by GET in the URL.

125.238.110.211 11:15, 26 January 2007 (UTC)Reply[reply]

MediaWiki 1.7.x[edit]

MediaWiki 1.7.1.[edit]

DPL v0.6[edit]

Requires MediaWiki 1.7.1.

DPL v0.5.1[edit]

I'm running a fairly small MediaWiki 1.7.1 and the following simple list I need works without problems (can't comment on the rest of the options though, but they seemed to work fine as far as tested) ~gandm:

<DPL>
count=15
ordermethod=lastedit
shownamespace=false
namespace=0
</DPL>

Where to get it?[edit]

The download links on the page seems to be not working right now. Is there an alternative location, from which to obtain the files? --MortenB 14:14, 26 August 2006 (UTC)Reply[reply]

An alternative location is now available. See Source_and_Installation. --Dangerville 19:22, 5 September 2006 (UTC)Reply[reply]
The links to the tuxfamily.org site have been fixed; version 0.7.8 and older ones are available for download from them. --Capmo 18:00, 24 September 2008 (UTC)Reply[reply]

Request for comment at English Wikipedia[edit]

There is a discussion at the English Wikipedia about a proposal to add the ability to create category intersections. It looks like DynamicPageList2 could be used to implement a good part of the proposal. We'd appreciate the feedback of any of the developers of DynamicPageList2. Thanks. -- SamuelWantman 21:03, 30 August 2006 (UTC)Reply[reply]

OK. --Dangerville 15:43, 3 September 2006 (UTC)Reply[reply]

Questions[edit]

Error with adduser[edit]

When I use adduser = true like this

<DPL>
category = Help
ordermethod = firstedit
order = ascending
resultsheader = <h2>Some title:</h2>
shownamespace = false
addeditdate = true
mode = ordered
adduser = true
</DPL>

I get this error:

Notice: Undefined property: stdClass::$mTitle in 
C:\Arquivos de programas\xampp\htdocs\wiki\extensions\DynamicPageList2\DynamicPageList2.php 
on line 1632

Fatal error: Call to a member function getPrefixedText() on a non-object in 
C:\Arquivos de programas\xampp\htdocs\wiki\extensions\DynamicPageList2\DynamicPageList2.php 
on line 1632

Am I doing something wrong? Is it a bug? --Fernandoacorreia 19:21, 14 February 2007 (UTC)Reply[reply]

No you are not doing wrong. You ran into a bug. Thank you for reporting. I fixed it and uploaded the new source (0.9.1) to the dpldemo website. You can now also find an example which shows the correct result now. Algorithmix 22:58, 14 February 2007 (UTC)Reply[reply]

List count[edit]

I'm not seeing a list count on any of the lists created with DynamicPageList2. Have I missed an option or does that not work with MW 1.6.5 and DPL2 0.6.3 combo? John Stanton 21:25, 12 September 2006 (UTC)Reply[reply]

See List Count in Header.

Heading Help[edit]

I am having problems with the heading method. It is my understanding that the following should be correct:

This Code:

Should yield this:

<DPL>
category=Cat 1|Cat 2
ordermethod=category,title
headingmode=definition
mode=ordered
</DPL>
<dl>
  <dt>Cat 1</dt>
  <dd>
    <ol>
      <li>Page1</li>
      <li>Page2</li>
    </ol>
  </dd>
  <dt>Cat 2</dt>
  <dd>
    <ol>
      <li>Page1</li>
    </ol>
  </dd>
</dl>

However, what I actually get is a listing of all the pages in Cat 1 and 2 sorted according to ALL of the other categories those pages are in. So every category that Page 1 and Page 2 are in, also show up on the list. This makes the list basically unusable.

<dl>
  <dt>A different cat</dt>
  <dd>
    <ol>
      <li>Page1</li>
      <li>Page2</li>
    </ol>
  </dd>
  <dt>Cat 1</dt>
  <dd>
    <ol>
      <li>Page1</li>
      <li>Page2</li>
    </ol>
  </dd>
  <dt>Cat 2</dt>
  <dd>
    <ol>
      <li>Page1</li>
    </ol>
  </dd>
  <dt>Another cat</dt>
  <dd>
    <ol>
      <li>Page1</li>
      <li>Page2</li>
    </ol>
  </dd>
</dl>
The result you just described was expected and intended, as strange as it might seem. The reasons:
  1. The developer's excuse: in the way I implemented it, to allow as much flexibility as I could, it happens to be easier to let the DPL show headings for all categories that the page may be in (less complex SQL query) - provided the page is in Cat1 or Cat2 in your example of course - than restrict the category headings only to the categories specified with the 'category' parameter (your Cat1 and Cat2). But that's mostly a coder's reason, therefore a bad reason for the user. Maybe I did not make myself clear anyway...
  2. In the way I see it, the 'category' parameter is just a filter. Once the pages have been filtered with it, we forget about the filter and we play with the pages we have left like we want. I mean we should be able to give it any format (ideally) and if we want category headings, we should be able to have all the categories the filtered pages link to (no matter what). No limit. You can also view it in your example as the list of all the intersections of categories with the Cat1-union-Cat2.
Despite all this blabla, I understand that the result might be unusable to you (and many others), so I'll think of an option to have that right in the next version. --Dangerville 21:20, 25 September 2006 (UTC)Reply[reply]
Thanks. That makes sense. I will look forward to any updates later.

The problem is now solved in v0.7.7 by using '+' with the category parameter. So in your example, you would have a slight difference (the '+' to say this list gives the headings):

<DPL>
category=+Cat 1|Cat 2
ordermethod=category,sortkey
headingmode=definition
mode=ordered
</DPL>

Something like this '+' is a way to tell DPL2 which category line is used for headings, since you can use the category parameter more than once. See the doc. --Dangerville 15:39, 1 October 2006 (UTC)Reply[reply]

After updating and trying this method, I now get this error:
%DPL2-0.7.7-WARNING: Wrong 'ordermethod' parameter: 'category,title'! Using default: 'title'. 
Help: ordermethod= category,firstedit | category,lastedit | category,pagetouched | category,sortkey 
| categoryadd | firstedit | lastedit | pagetouched | title | user,firstedit | user,lastedit.
Indeed, as said in DynamicPageList2#ordermethod, the 'category,title' ordermethod has been replaced in 0.7.7 with 'category,sortkey' to satisfy a feature request for more flexibility and reuse of sortkeys in category tags. This has the same effect as the old 'category,title' when no sortkey is defined (the full title is simply used as the sortkey). --Dangerville 12:22, 12 November 2006 (UTC)Reply[reply]

categoryadd restriction[edit]

Dangerman, thank you for taking my old extension and making it so much more useful. I want to deploy DPL2 on Wikinews instead of (in addition to) the old DynamicPageList. The only change that I don't understand is why there's a restriction on only allowing ordermethod=categoryadd when there is exactly one category included? The original design was just to order the output based on the date of addition to the first category mentioned. If you don't disagree, I'll add that feature back in. -- IlyaHaykinson 05:03, 1 November 2006 (UTC)Reply[reply]

To tell the truth, I can't recall. (Maybe it was already the case in the v0.3.3 I got from Unendlich, but it is no longer available so I can't check and I may be wrong.) I think I made this change because for instance, if you have a union of categories like category= Cat1 | Cat2, you can't sort the pages that are in Cat2 but not in Cat1. So what to do with these? One solution - extreme I admit - is to do the restriction you mentioned. We could also allow only intersections of categories with 'ordermethod=categoryadd'. If you want to remove the restriction and propose another solution, go ahead, no problem. Last, I added 'ordermethod=category,categoryadd' to the todo list. This would do like 'ordermethod=category,firstedit' for example, but using the date of addition to the category (not only the first one but each of them specified), instead of the first edit. The problem would be over. --Dangerville 16:07, 9 November 2006 (UTC)Reply[reply]

Category Intersections[edit]

Does anyone know how they've created this CategoryQuery Special Page over at the Princeton University QED website? It makes it really easy to do category intersections and appears to use DPL.--Weakmassive 15:30, 4 November 2006 (UTC)Reply[reply]

New features[edit]

Hi, ive added two new features: Source and diff (Originating from [3])

Display TOC[edit]

It Displays also the TOC as sub-items if mode is unordered or ordered. Syntax:

<DPL>
toc=true
</DPL>

Search and Replace[edit]

It allow replacing text in the Page Title. Example:

<DPL>
search=/FAQ:/|/foo/i
replace=|baar
</DPL>

This Example should Replace "FAQ:" through nothing, and foo or FoO through baar.

Hope you like it! --Joschua 00:17, 1 December 2006 (UTC)Reply[reply]

File Cache Issue[edit]

DPG2 has issues with file caching because the file cache is only updated when a user saves/updates the page itself the DPG list/data contained is frozen to the time/date of the updated page and updated cache.

While DPG2 seems to "disable cache" in the code but doesn't stop mediawiki 1.8 from creating the cache file nor does it force it to update the cache.

  • finding a trigger to stop the creation or stop the cache from being made (not the best idea if you need file caching working!)
  • find a way to update cache that is over 1-24 hours old would be great because the caching system would still be active and data wouldn't be outdated for more then the set period of time

I've tried a crontab to delete the cache every 15 minutes BUT crontabs don't seem to like

  • "rm /cache/e/ea/Wii%2FNews.html"
  • as it will error "rm: cannot remove `/cache/e/ea/Wii': No such file or directory"
The "%2F" is probably a URLencoded character (%2f is equivalent to a "slash"), so you might want to try "rm /cache/e/ea/Wii/News.html"
Hope it helps. -- Algorithmix
Nope :( - the slash is obviously picked up by the shell as a directory not a file lable. - Any other ideas?

New Years broke DPL2![edit]

Check it out: http://ddo.enterwiki.net/page/Home http://ddo.enterwiki.net/page/Special:Recentchanges

The pages appearing in the recentchanges list on the side weren't actually edited since early last year! Odd. (You can reach me at my user talk page)

Problems with sortkey[edit]

I'm trying to sort a list by using "ordermethod=category,sortkey", but I get an error :

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

    (SQL query hidden)

from within function "". MySQL returned error "1267: Illegal mix of collations (latin1_bin,IMPLICIT) and (utf8_general_ci,IMPLICIT) for operation 'ifnull' (internal-db.s2603.gridserver.com)".

Any idea how I could fix this? I'm using DPL2 Version 0.8.1 and MW 1.9 (I got the same error when I was using 1.8 too). Thanks --Weakmassive 17:26, 18 January 2007 (UTC)Reply[reply]

Number of Columns[edit]

I'm trying to get a multi-column list that looks like category pages sans the alphabetical headers, but I can't quite figure how to do that. Also, is there way I can specify the number of columns? —Sledged 02:14, 1 February 2007 (UTC)Reply[reply]

Version 0.9 of DPL2 has a new parameter "columns=" which does what you are asking for. See [4], at "other Examples". Algorithmix 06:46, 13 February 2007 (UTC)Reply[reply]

Extension page[edit]

Is this the same as mw:Extension:DynamicPageList? If yes, which page is more up-to-date? --Fernandoacorreia 17:38, 14 February 2007 (UTC)Reply[reply]

Yes, it is the same. The most recent version of DPL is 0.92. Source code and examples for this version can be found on a separate website (dpldemo) where the extension is also installed. This allows interested people to see DPL live and make some experiments before they decide to install the extension on their web site.
Source code of version 0.8x and earlier can be found in SVN. Algorithmix 21:40, 14 February 2007 (UTC)Reply[reply]


Installation issues[edit]

(NB: I have also posted this question at DPLDEMO here [5] sorry for the duplication)

Great extension that I was using on a previous version of mediawiki. Now have moved my site and upgraded to:

  • Mediawiki 1.9.0
  • MySQL 4.1
  • DPL 0.9x

and I can't get it to work at all.

  1. I downloaded and copied DynamicPageList2.php from the manual page into extensions.
  2. added require_once("extensions/DynamicPageList2.php");

No good.. test page of

 <DPL> 
 category = CNS 
 </DPL>
just renders
<DPL> category = CNS </DPL>  

as text.

tried to add Labeled Section Transclusion files with changes to localsetting.php

require_once("extensions/DynamicPageList2.php"); 
require_once("extensions/lst.php");
require_once("extensions/lsth.php");
require_once("extensions/compat.php");

Still no good.

I am not sure what else needs to be done...

test page for my site is here: [6]

--BigBad256 03:23, 18 February 2007 (UTC)Reply[reply]

See my answer on the DPL website -- Algorithmix 07:50, 18 February 2007 (UTC)Reply[reply]

Table of Content and NOTOC[edit]

Helo. DPL2 working fine, but does not seem to work, ie TOC still gets rendered in the first column of results.

Any ideas? thanks... --BigBad256 23:13, 17 March 2007 (UTC)Reply[reply]

Please demonstrate the problem you have with a small example on the dpldemo website. Then I will try to help you.

--Algorithmix 14:23, 14 March 2007 (UTC)Reply[reply]

I am afraid you need a list of entries long enough such to generate an A, B, C etc.. TOC for the DPL entry.

See new example here eventhough

 __NOTOC__ 

is on page, and successfully removes the TOC for the test headings.

This is the content of the test page.

<DPL>
category=CNS
category=WR Ency
ordermethod=title
mode=category
</DPL>

==Test Heading 1==
==Test Heading 2==
==Test Heading 3==
==Test Heading 4==
==Test Heading 5==
==Test Heading 6==

__NOTOC__

--BigBad256 23:13, 17 March 2007 (UTC)Reply[reply]

You have to put the NOTOC clause into the resultsheader parameter of DPL. Then it works. Note: This is the wrong place to discuss DPL 0.9 and later (which you are using). You really should go to the dedicated [dpl website].

--Algorithmix 18:50, 20 March 2007 (UTC)Reply[reply]

Thanks Algorithmix, and sorry about the misplaced query.

--BigBad256 10:50, 24 March 2007 (UTC)Reply[reply]

Ignore 'minor' edits[edit]

Related to the earlier closed item "Supress 'minor' edits..." and minoredits parameter to ignore minor edits.

The problem is that using 'minoredits' parameter excludes such articles from the list completely, which should not be the case. To me the functionality is faulty, and this should be fixed. As illustration two cases

1. I want to create a list of articles in editing date order, yet to prevent minor edits to push such articles (minor edited) on the top, however by using minoredits parameter articles which are last time minor edited disappear from the list completely, i.e. then only some of the articles are listed, not all. So in practise this parameter can not be used for that purpose. Instead the functionality of the parameter should be such that date and thereby order is determined based on the last "normal/major" edit.

2. Often when new articles appear there is something small to fix, and the most recently edited article list uses exclude minoredits parameter. Right indication would be to use minor edit option, yet if I do, then those get thrown out of that recently edited list immediately. So in practise minor edit option can not be used (for additional minor edits) for a new article or for an article where there has just been major edits.

Please add "minoredits=ignore" (besides current "minoredits=exclude"), which works as described, i.e. uses last normal edit (non-minoredit) to determine the date/time stamp, and does not exclude the articles completely.

--Jaaura 10:15, 9 December 2007 (UTC)Reply[reply]