DPL talk:Manual

From FollowTheScore
Jump to: navigation, search

Pivot Table?

This seems like it should be a desirable switch, so perhaps I'm missing something obvious.

Is there any way to have ordering go across rows, rather than down columns?

If one is displaying page names with a regular periodic pattern, it makes sense to order them in rows, rather than columns.

For example, if you are showing pages of statistics, and the pages all have names like "YYYY-MM", it would make sense to have them display like this:


rather than:


I haven't seen an obvious way of doing this.

If it doesn't exist, I envision something like

  • displayorder=rows|columns

Thanks for a great tool! I use it a lot!

Jan Steinman (talk) 09:02, 15 May 2014 (CEST)

unfortunately I don't think that this is feasible at the moment. The problem lies not with DPL but with Mediawiki itself: Mediawiki does not provide a way to do so in any reasonable fashion. Just look at your own examples: Mediawiki doesn't even provide a way to switch rows with colums on a table when the table is directly written into the source of the page, which is why you had to rearrange the entire table manually to write down your examplary table 2. Therefore I think you should ask the Mediawiki developers to come up with a way to flip tables, and merge that fix into Mediawiki itself, so it can then be used by extensions. --Theaitetos (talk) 22:36, 23 May 2014 (CEST)

Counting Results

So which parameter(s) will give me a count of the number of pages that fit the criteria instead of the pages themselves? —Sledged (talk) 04:49, 29 November 2007 (CET)

I don´t understand your question. Give an example. Gero 08:47, 29 November 2007 (CET)

Let's take the search criteria in the example on the Main Page:
category=African Union member states
There are three pages that match this criteria, so I want the output:
instead of getting a list of those pages. I just want to count the number of pages that match the criteria. I thought I'd be able to specify that with the mode parameter, but that doesn't seem to be an option. —Sledged (talk) 15:40, 29 November 2007 (CET)

o.k. : use The %PAGES% parameter in the resultsheader. It will contain the correct value even if you use regular expression to filter template calls by the parameter values they use.
Gero 17:13, 29 November 2007 (CET)

Top Most Visited Pages ?

Is there a way with DPL to get the N "Top Visited Pages" during a specified period ? Ex: get the 10 most visited page since the begining of the week ?


I don´t think so. The page counter in the wiki database is not attached to the history. Using DPL you could make a snapshot of (say) the 200 pages with the highest usage rank plus those pages that were modified recently (although they may have low usage rates). If you do that regularly you could then use ploticus to generate a graph of incremental usages. Gero 19:09, 14 December 2007 (CET)

Add UserGroup criteria function?

Can you add a page list criteria by a User's user group? It would be a nice addition for groups to share files and communication. thanks.

Could you be more precise, please?

  • how should the command be named?
  • what exactly should it do?
  • what do you mean by 'user group'?
  • can you gove an example?
Gero 22:26, 6 May 2008 (CEST)

Hi, I'll be more clear..

Each user belongs to a user group like sysop, user, bureaucrat, or a custom named group like 'author'. Right now, you can list articles written by a user or by namespace like:

<DPL> createdby=Joe </DPL>

<DPL> namespace=something </DPL>

It would be useful to list articles by usergroup like; <DPL> byusergroup=sysop </DPL>



Well, that is not too complicated and I think it is a useful feature. In the last time I try to motivate people to do such minor changes to DPL themselves. I always offer to test, document and integate the solution into the next release. The idea is that DPL is only then real open source if more than one person (i.e. me) is in contact with the sources. Are you capable of doing it or do you know somebody who could do it? Gero 19:12, 8 May 2008 (CEST)

reply reply

I'm good at hacking. Is there a manual for variables, classes, codes for DPL anywhere?


There is no technical documentation regarding the code so far. But there are useful inline comments. It is only the larger source file that you would need to change. The smaller one only deals with transclusion of contents. The larger source has three or four classes - some of which are rather huge but very straight forward. Parsing the input (i.e. checking parameters) takes a lot of lines .. I inherited the code and never found time to break those classes into smaller pieces. Maybe I should put that on my agenda. Gero 08:07, 9 May 2008 (CEST)

reply x 4

Ugh... I'm looking the variables for the mysql query right now and it's giving me a headache.

I think I got it (not really)

Here's the working query

SELECT DISTINCT `page`.page_namespace as page_namespace,`page`.page_title as page_title, REPLACE(REPLACE(CONCAT( IF(`page`.page_namespace=0, , CONCAT(CASE `page`.page_namespace WHEN 1 THEN 'Talk' WHEN 2 THEN 'User' WHEN 3 THEN 'User_talk' WHEN 4 THEN 'LwcWiki' WHEN 5 THEN 'LwcWiki_talk' WHEN 6 THEN 'Image' WHEN 7 THEN 'Image_talk' WHEN 8 THEN 'MediaWiki' WHEN 9 THEN 'MediaWiki_talk' WHEN 10 THEN 'Template' WHEN 11 THEN 'Template_talk' WHEN 12 THEN 'Help' WHEN 13 THEN 'Help_talk' WHEN 14 THEN 'Category' WHEN 15 THEN 'Category_talk' WHEN 100 THEN 'Calendar' WHEN 101 THEN 'Relation_talk' WHEN 102 THEN 'CommonCalendar' WHEN 103 THEN 'Property_talk' WHEN 104 THEN 'Type' WHEN 105 THEN 'Type_talk' WHEN 106 THEN 'Form' WHEN 107 THEN 'Form_talk' END, ':')), `page`.page_title), '_', ' '),'♣','⣣') as sortkey FROM `user_groups`, `revision`, `page` WHERE 1=1 AND `page`.page_is_redirect=0 AND `revision`.rev_user=`user_groups`.ug_user AND `user_groups`.ug_group='author' AND `revision`.rev_page=page_id ORDER BY sortkey ASC LIMIT 0, 500

Although sysop gets to see all the articles I've noticed, I guess that's how it is.. Now I need to find a way to sort this by date/time. It blows up when I put in a ordermethod criteria.

I got it this time

SELECT DISTINCT `page`.page_namespace as page_namespace,`page`.page_title as page_title, REPLACE(REPLACE(CONCAT( IF(`page`.page_namespace=0, , CONCAT(CASE `page`.page_namespace WHEN 1 THEN 'Talk' WHEN 2 THEN 'User' WHEN 3 THEN 'User_talk' WHEN 4 THEN 'LwcWiki' WHEN 5 THEN 'LwcWiki_talk' WHEN 6 THEN 'Image' WHEN 7 THEN 'Image_talk' WHEN 8 THEN 'MediaWiki' WHEN 9 THEN 'MediaWiki_talk' WHEN 10 THEN 'Template' WHEN 11 THEN 'Template_talk' WHEN 12 THEN 'Help' WHEN 13 THEN 'Help_talk' WHEN 14 THEN 'Category' WHEN 15 THEN 'Category_talk' WHEN 100 THEN 'Calendar' WHEN 101 THEN 'Relation_talk' WHEN 102 THEN 'CommonCalendar' WHEN 103 THEN 'Property_talk' WHEN 104 THEN 'Type' WHEN 105 THEN 'Type_talk' WHEN 106 THEN 'Form' WHEN 107 THEN 'Form_talk' END, ':')), `page`.page_title), '_', ' '),'♣','⣣') as sortkey FROM `page` WHERE 1=1 AND `page`.page_is_redirect=0 AND 'PGauthor'=(select ug_group from `user_groups`, `revision` where `user_groups`.ug_user=`revision`.rev_user AND `revision`.rev_page=page_id order by `revision`.rev_timestamp ASC limit 1) ORDER BY sortkey ASC LIMIT 0, 500

I'm not sure 100% it's bug free but it looks like it's working.


Fine, that´s the first step. Now you must teach DPL to generate this query statement depending on your new parameter. Once you have a running version installed in a publicly available wiki, please let me know. Gero 01:43, 11 May 2008 (CEST)

Reply to the Reply

Yeah, I have it running dynamically. No bugs so far although the listseparators tables are blowing up, like listseparators={|,%PAGE%,,|}.. I think it has trouble parsing the wiki text.. Not sure what I did to have anything to do with the formatting.

Sorry, the wiki is not a public wiki... I'll install a public wiki for you when I get a chance.

Working version up


Is it possible to create a USER list?

Finally a new topic.. I want to create a user list like in SPECIAL:Listusers and maybe how many articles they've written.. All the parameters seems to revolve around the articles. Do I have to write this function too?



Indeed the functionality of DPL centers around articles. But user homepages have their own namespace. So you can at least easily catch those users with DPL who have their own homepage. If you really want a list of all users you would have to add that function. There is a parameter named goal which currently has only the function to produce results of categories. You might want to add goal=users.

Sometimes I ask users to insert a small template on their homepage gifing data about their name, interest etc. This works best in non-publich wikis where you have people who know and trust each other in the wiki. Then you can extract temaplte values from these pages and create a meaningful user list. We even use templates on the users´ homepages to automaticall create TODO-lists for them (which come from othetr articles that contain the minutes of meetings where tasks were assigned to different people...

If you are interested in that kind of stuff I could upload a copy of those templates.

Gero 17:41, 12 May 2008 (CEST)


Thanks for the hints.. Yes upload those templates. I think everybody would be interested in that.

Using Thousands of DPL invocations on high traffic pages

Hi, I'm starting to realise that for my website to be where I want it to be, I will need thousands of DPL invocations on my different pages. These pages will probably get very high traffic eventually, and some pages may contain up to 20-30 DPL invocations. I was wondering if you think this will put a big load on the CPU of a dedicated server - I mean I know loading any page in mediawiki with high traffic and lots of content will in fact put a certain load on the CPU but I was wondering : does DPL cache its output or does it refreshes it every time a users goes to a page ? Does it search the whole mediawiki database every time a new user comes to a given page ? Basically, will the load be abnormally high compared to regular, mysql-database-only queried pages ?

EmuWikiAdmin1, July 18th 2008


My best, --Gollum2 20:56, 28 August 2008 (UTC)


I'm not sure if this is possible but I want to make a page doing it the long way would be the equivalent of:
{{some template|1st page in category}}
{{some template|2nd page in category}}
{{some template|3rd page in category}}

Is this possible using dlp? thanks Redekopmark 09:17, 24 August 2008 (CEST)

YES, see Applying a template to all pages of a given category
Gero 06:43, 29 August 2008 (UTC)

decimal separators

Is it possible to change the decimal separator from "." to ","? In Germany and other European countries we use the comma for decimal separation. However in DPL, values which have "," do not get sorted correctly. Is there a workaround? Thanks and Greetings, --Gollum2 10:20, 28 August 2008 (UTC)

Listing what categories a page belongs to & more

I've been trying to do this for hours now, after hours of looking for an extension that would let me do it... I have a page which belongs to a number of categories. I want that page to contain a list of the categories it belongs to, the list excluding categories that are also subcategories of category "A", but including other categories that are subcategories of category "B". How should I go about doing this?

This is as far as I've got:
title = Valtiahav Vartiat
addcategories = true
format = ,\n* [[%CATNAMES%]],,

Oddly enough, it works fine on any page other than the one you specify in the "title", that is, this piece of code on the page "Valtiahav Vartiat" doesn't work but if I put the exact same thing on another page it works fine.

Please note that DPL be default excludes the current page from being part of the result of a DPL query (there are good reasons for that, btw. However, there is an option to switch this behaviour off: skipthispage -- see the manual. Gero 07:39, 5 March 2009 (UTC)
Ok. What about an onlythispage?

The other issue is that I can't limit the hits found by %CATNAMES% - it really returns a list of EVERY category the page belongs to. Can't this be changed so that it includes and excludes categories from specified supercategories? Maybe you could even make one called %CATNAMESLTD% or similar that does this? Also, there's no way to make a bulleted list of out these category lists. --Dafydd 23:35, 4 March 2009 (UTC)

Indeed, the list of categories a page belongs to is somewhat restricted in its capabilities. Using #replace you could change the formatting. You woould have to use the StringFunctions version from our download to do this because you would have to use regular expressions within #replace. Checking for supercategories would require another embedded DPL query within your query. I think this is possible but it may take you some time to figure out how it can be done. An alternative would be to add that feature directly to the DPL php source. If you can do it I will make it part of the next release. Gero 07:39, 5 March 2009 (UTC)

I managed to do what I wanted to by using "linksto". Now I'm wondering about a few other things.

  • Under the parameter "redirect", I found this:
"The result will consist of content pages and redirect pages tagged with [[Category:Africa]]. 
Note: this parameter does not show pages that link to the redirect (as Special:Whatlinkshere/DPL:Discussion does);
 only redirect pages themselves. "
Could a parameter that does just this (i.e. what "redirect" does not do) be made, or is there a reason why such a thing wouldn't work? If such a thing was implemented, it would be nice if there was an option to exclude the redirect pages themselves from the list. EDIT: I just found this... http://semeb.com/dpldemo/index.php?title=DPL:FAQ#When_I_write_a_.22What_links_here.22_DPL_query.2C_redirections_are_ignored
  • For categories, you can use either OR (pipe) or AND (ampersand) to list articles that belong to either of the listed categories or list only articles that belong to all of the listed categories. But for linksto you can only use OR, not AND. Can this please be fixed? It shouldn't be a hard thing to do for someone who managed to make the rest of this amazing thing.
Indeed this is a question of time only ;-) Gero 13:02, 6 March 2009 (UTC)
Cool. Any estimate whatsoever? I could really use a this feature right away... :Þ Dafydd 18:42, 13 March 2009 (UTC)
  • Is there a way to use linksto = %THISPAGE% or similar, to list pages that links to the very page the list is on? I know you can already do this by writing the name of the article you're in, but having this feature could be useful.
You can use the PAGENAME or FULLPAGENAME macro. Gero 13:02, 6 March 2009 (UTC)
  • Can a parameter to exclude category pages from lists be implemented? This would be really useful if you have a category and want to list all the pages that belong to subcategories of this category, but not the subcategories themselves.
notnamespace should do the job. Gero 13:02, 6 March 2009 (UTC)

Several of the above things may be possible to create using templates, but I don't really know how they work. Examples would be very much appreciated.

--Dafydd 11:33, 5 March 2009 (UTC)

Reporting Categories & sub categories + related pages

I have a few questions about DLP. I am running MediaWiki 1.14, on WAMP, php 5.2.5, MySQL 5.0.45. I have 2 issues, I am hoping you can at least address the one about DLP. I would like to use this extension to build dynamic category menus. I sure it's possible, but most likely beyond me - I want the tree/menu to list sub categories that are associated with the main category on a second layer if you will. (another menu list to the right of the primary articles)


Cranks out only the articles with the [[Category:Foo]] tag. The problem is some of those articles are categories too but they don't expand. Ideally, I'd like the whole structure to expand. Parent Category=>It's child categories + associated pages=>Subcategories of the children + any pages tagged by said subcategories.

My next question doesn't really involve DPL but you package Treeview in your Download so I'll give it a shot. For the life of me, I can't get the the menu function work correctly without putting likewise tree function with it. Is that working as intended? I'll Post the code I am using to make TreeandMenu work on my wiki.The menu alone breaks the page, the menu panes don't line up right and it's a mess. Both together and bam works great. (minus the missing sub cats and pages I need listed)

<div class="portlet">
<div class='pBody'>
*[[Main Page]]


Any help would be greatly appreciated. Thanks in advance for your time. -- Doylezor 21:01, 13 May 2009 (UTC)

nested dpl queries w/o the use of templates...

from all of my search am i correct in assuming this isnt possible?Dpluser 19:39, 18 September 2009 (UTC)

No, you are not correct.
It is possible to nest DPL queries (or call some parser function within a DPL statement). This does not depend on the use of templates.
You simply have to use the ²{#func:parm¦parm2¦parm3¦..}² Syntax as is explained in the manual.
Gero 09:24, 21 September 2009 (UTC)
Thanks i seem to be having some trouble here is what i am using below.
|format=,*[[%PAGE%¦²{SUBPAGENAME:%PAGE%}²]]\n²{#dpl:debug=1¦category=Features¦titlematch=%PAGE%%¦nottitlematch=%Template%¦format=,**[[%PAGE%¦²{SUBPAGENAME:%PAGE%}²]]\n,, }²,,
What seems to be happenining is in the format of the nested query %PAGE% is still set to what was found in the parent query. any thoughts?Dpluser 13:58, 21 September 2009 (UTC)
Oh yes, this could be a problem. Try to hide the %PAGE% which shall be interpreted by the subquery by using a template. Write a template file which contains only a single %-sign and call it 'pct'. Then use {{pct}}PAGE{{pct}}. This kind of approach has helped in sinmilar situations. Let nme know is it works for you. Gero 19:11, 21 September 2009 (UTC)
I ended up just having the nested query in a template.