Difference between revisions of "DPL talk:Manual"
(→Listing what categories a page belongs to) |
Theaitetos (talk | contribs) (→Pivot Table?: Answer) |
||
(21 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
+ | == 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: | ||
+ | |||
+ | <table> | ||
+ | <tr><td>2014-01</td><td>2014-02</td><td>2014-03</td><td>2014-04</td><td>2014-05</td><td>2014-06</td><td>2014-07</td><td>2014-08</td><td>2014-09</td><td>2014-10</td><td>2014-11</td><td>2014-12</td></tr> | ||
+ | <tr><td>2013-01</td><td>2013-02</td><td>2013-03</td><td>2013-04</td><td>2013-05</td><td>2013-06</td><td>2013-07</td><td>2013-08</td><td>2013-09</td><td>2013-10</td><td>2013-11</td><td>2013-12</td></tr> | ||
+ | <tr><td>2012-01</td><td>2012-02</td><td>2012-03</td><td>2012-04</td><td>2012-05</td><td>2012-06</td><td>2012-07</td><td>2012-08</td><td>2012-09</td><td>2012-10</td><td>2012-11</td><td>2012-12</td></tr> | ||
+ | </table> | ||
+ | |||
+ | rather than: | ||
+ | |||
+ | <table> | ||
+ | <tr><td>2014-01</td><td>2014-04</td><td>2014-07</td><td>2014-10</td><td>2013-01</td><td>2013-04</td><td>2013-07</td><td>2013-10</td></tr> | ||
+ | <tr><td>2014-02</td><td>2014-05</td><td>2014-08</td><td>2014-11</td><td>2013-02</td><td>2013-05</td><td>2013-08</td><td>2013-11</td></tr> | ||
+ | <tr><td>2014-03</td><td>2014-06</td><td>2014-09</td><td>2014-12</td><td>2013-03</td><td>2013-06</td><td>2013-09</td><td>2013-12</td></tr> | ||
+ | </table> | ||
+ | |||
+ | 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! | ||
+ | |||
+ | [[User:Jan Steinman|Jan Steinman]] ([[User talk:Jan Steinman|talk]]) 09:02, 15 May 2014 (CEST) | ||
+ | |||
+ | :Hello, | ||
+ | :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. --[[User:Theaitetos|Theaitetos]] ([[User talk:Theaitetos|talk]]) 22:36, 23 May 2014 (CEST) | ||
+ | |||
== Counting Results == | == Counting Results == | ||
Line 153: | Line 188: | ||
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, --[[User:Gollum2|Gollum2]] 10:20, 28 August 2008 (UTC) | 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, --[[User:Gollum2|Gollum2]] 10:20, 28 August 2008 (UTC) | ||
− | == Listing what categories a page belongs to == | + | == 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? | 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? | ||
Line 180: | Line 215: | ||
<pre>"The result will consist of content pages and redirect pages tagged with [[Category:Africa]]. | <pre>"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); | Note: this parameter does not show pages that link to the redirect (as Special:Whatlinkshere/DPL:Discussion does); | ||
− | only redirect pages themselves. "</pre> 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. | + | only redirect pages themselves. "</pre> 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. | *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 ;-) [[User:Gero|Gero]] 13:02, 6 March 2009 (UTC) | ||
+ | :::Cool. Any estimate whatsoever? I could really use a this feature right away... :Þ [[User:Dafydd|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 | + | *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. [[User:Gero|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. [[User:Gero|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. | ||
− | *Can | + | * Can someone help me with this? http://www.semeb.com/dpldemo/index.php?title=DPL:FAQ#Example_query.2C_please.3F |
--[[User:Dafydd|Dafydd]] 11:33, 5 March 2009 (UTC) | --[[User:Dafydd|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) | ||
+ | |||
+ | <pre>{{#dpl:category=Foo|format=,**,[[%PAGE%]]\n,}}</pre> | ||
+ | |||
+ | Cranks out only the articles with the <nowiki>[[Category:Foo]]</nowiki> 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) | ||
+ | <pre> | ||
+ | <div class="portlet"> | ||
+ | <div class='pBody'> | ||
+ | *[[Main Page]] | ||
+ | *[[Sandbox]] | ||
+ | {{#menu: | ||
+ | *[[:Category:Gages|Gages]] | ||
+ | {{#dpl:category=Gages|format=,**,[[%PAGE%]]\n,}} | ||
+ | *[[:Category:Parts|Parts]] | ||
+ | {{#dpl:category=Parts|format=,**,[[%PAGE%]]\n,}} | ||
+ | *[[:Category:Material|Material]] | ||
+ | {{#dpl:category=Material|format=,**,[[%PAGE%]]\n,}} | ||
+ | }} | ||
+ | |||
+ | {{#tree: | ||
+ | {{#dpl:category=Gages|format=,**,[[%PAGE%]]\n,}} | ||
+ | {{#dpl:category=Parts|format=,**,[[%PAGE%]]\n,}} | ||
+ | {{#dpl:category=Material|format=,**,[[%PAGE%]]\n,}} | ||
+ | }} | ||
+ | <br> | ||
+ | </div> | ||
+ | </div> | ||
+ | </pre> | ||
+ | |||
+ | Any help would be greatly appreciated. Thanks in advance for your time. -- [[User:Doylezor|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?[[User:Dpluser|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 [[DPL:Manual_-_General_Usage_and_Invocation_Syntax#Characters_with_special_meaning|manual]]. | ||
+ | :[[User:Gero|Gero]] 09:24, 21 September 2009 (UTC) | ||
+ | |||
+ | ::Thanks i seem to be having some trouble here is what i am using below. | ||
+ | :: | ||
+ | <pre> | ||
+ | {{#tree:openlevels=1| | ||
+ | {{#dpl:debug=5 | ||
+ | |category=Components | ||
+ | |titlematch=Houdini% | ||
+ | |nottitlematch=%Template% | ||
+ | |format=,*[[%PAGE%¦²{SUBPAGENAME:%PAGE%}²]]\n²{#dpl:debug=1¦category=Features¦titlematch=%PAGE%%¦nottitlematch=%Template%¦format=,**[[%PAGE%¦²{SUBPAGENAME:%PAGE%}²]]\n,, }²,, | ||
+ | }} | ||
+ | }} | ||
+ | </pre> | ||
+ | ::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?[[User:Dpluser|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 <nowiki>{{pct}}PAGE{{pct}}</nowiki>. This kind of approach has helped in sinmilar situations. Let nme know is it works for you. [[User:Gero|Gero]] 19:11, 21 September 2009 (UTC) | ||
+ | |||
+ | :::: I ended up just having the nested query in a template. |
Latest revision as of 21:36, 23 May 2014
Contents
- 1 Pivot Table?
- 2 Counting Results
- 3 Top Most Visited Pages ?
- 4 Add UserGroup criteria function?
- 5 Is it possible to create a USER list?
- 6 Using Thousands of DPL invocations on high traffic pages
- 7 question
- 8 decimal separators
- 9 Listing what categories a page belongs to & more
- 10 Reporting Categories & sub categories + related pages
- 11 nested dpl queries w/o the use of templates...
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:
2014-01 | 2014-02 | 2014-03 | 2014-04 | 2014-05 | 2014-06 | 2014-07 | 2014-08 | 2014-09 | 2014-10 | 2014-11 | 2014-12 |
2013-01 | 2013-02 | 2013-03 | 2013-04 | 2013-05 | 2013-06 | 2013-07 | 2013-08 | 2013-09 | 2013-10 | 2013-11 | 2013-12 |
2012-01 | 2012-02 | 2012-03 | 2012-04 | 2012-05 | 2012-06 | 2012-07 | 2012-08 | 2012-09 | 2012-10 | 2012-11 | 2012-12 |
rather than:
2014-01 | 2014-04 | 2014-07 | 2014-10 | 2013-01 | 2013-04 | 2013-07 | 2013-10 |
2014-02 | 2014-05 | 2014-08 | 2014-11 | 2013-02 | 2013-05 | 2013-08 | 2013-11 |
2014-03 | 2014-06 | 2014-09 | 2014-12 | 2013-03 | 2013-06 | 2013-09 | 2013-12 |
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)
- Hello,
- 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 nottitlematch=Sudan
- There are three pages that match this criteria, so I want the output:
3
- 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 ?
Reply
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>
thanks.
Reply
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?
reply³
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.
Reply
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
[[1]]
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?
thanks..
Reply
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)
Cool
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
Reply
- This might help: allow cached results
My best, --Gollum2 20:56, 28 August 2008 (UTC)
question
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:
<DPL>
title = Valtiahav Vartiat
addcategories = true
format = ,\n* [[%CATNAMES%]],,
</DPL>
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.
- 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.
- Can someone help me with this? http://www.semeb.com/dpldemo/index.php?title=DPL:FAQ#Example_query.2C_please.3F
--Dafydd 11:33, 5 March 2009 (UTC)
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)
{{#dpl:category=Foo|format=,**,[[%PAGE%]]\n,}}
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]] *[[Sandbox]] {{#menu: *[[:Category:Gages|Gages]] {{#dpl:category=Gages|format=,**,[[%PAGE%]]\n,}} *[[:Category:Parts|Parts]] {{#dpl:category=Parts|format=,**,[[%PAGE%]]\n,}} *[[:Category:Material|Material]] {{#dpl:category=Material|format=,**,[[%PAGE%]]\n,}} }} {{#tree: {{#dpl:category=Gages|format=,**,[[%PAGE%]]\n,}} {{#dpl:category=Parts|format=,**,[[%PAGE%]]\n,}} {{#dpl:category=Material|format=,**,[[%PAGE%]]\n,}} }} <br> </div> </div>
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.
{{#tree:openlevels=1| {{#dpl:debug=5 |category=Components |titlematch=Houdini% |nottitlematch=%Template% |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.