Difference between revisions of "DPL:Discussion"

From FollowTheScore
Jump to: navigation, search
(all namespaces)
m (Show Articles in one Category by Sortkey)
Line 192: Line 192:
  
 
:Well, don't you think DPL should be able to do that inherently like it can with categories and pages? -[[User:Eep²|Eep²]] 13:29, 29 August 2007 (CEST)
 
:Well, don't you think DPL should be able to do that inherently like it can with categories and pages? -[[User:Eep²|Eep²]] 13:29, 29 August 2007 (CEST)
 +
 +
== Show Articles in one Category by Sortkey ==
 +
 +
I just created these 3 Articles which are categorized in a different order than the title names:
 +
{{#dpl:category=VolkoV}}
 +
<pre><nowiki>{{#dpl:category=VolkoV}}</nowiki></pre>
 +
How is is possible to sort the Articles in the categorized order?--[[User:VolkoV|VolkoV]] 18:37, 31 August 2007 (CEST)

Revision as of 17:37, 31 August 2007

Note: There is a special document for DPL:Bug Reports.

Existing bug reports in this document have been moved to the DPL:Bug Reports.


Could make it possible to show page names by setting in a .dpl template page

I can show pagetitle by adding"%TITLE%" in listseparators but I still want to show the pagenames by adding {{PAGENAME}} or "%TITLE%" in the .dpl template page. Therefore, we can use descriptions such like {{sub:{{PAGENAME}}8|4}} or {{sub:%TITLE%|8|4}} to do something I want. Any ideas Thanks!--Roc michael 17:42, 5 July 2007 (CEST)

PAGETITLE in templates

You can use {{{%TITLE%}}} and {{{%PAGE%}}} within templates. See the manual. Gero 23:51, 5 July 2007 (CEST)

Thinks, Gero! It works very well.--Roc michael 07:47, 7 July 2007 (CEST)

Concept of Subpages

Is there anybody who could explain what subpages are and if they are relevant for DPL ? --Gero 16:01, 15 February 2007 (CET)

Feedback

Thank you for this extension! I was able to create some rather complex queries that receive parameters through templates and that show a list of pages, creation date and author inside some categories. It solved our needs very well. Fernando Correia

Developer level access

Hi there. I was one of the original authors of the DPL (a long time ago, when MediaWiki was simpler and the extension fit on one printed page). I need to make a few changes to make the extension deployable on Wikinews — specifically, the addfirstcategorydate restriction to only work if only one category is included should be removed, and we need to add some simple date formatting to make it possible to show only the date, and not always the date and time (I was thinking of switching the default to show just the date as the older extension does, and make the date/time only appear if something like showdateandtime=true is specified.) I can make the changes, or provide patches; please let me know where the source code repository is (I notice that the mediawiki svn has a much older extension version). You can contact me by email, or at Wikinews -- IlyaHaykinson 11:26, 25 February 2007 (CET)

I would like to support you in rolling out DPL to Wikinews. For the moment I added a generic feature for date formatting. This allows you to configure your date/time format individually, see the DPL:Manual#userdateformat. Sourcecode is here in this wiki but I plan to make it available also in subversion. Could you specify an example for your request regarding "addfirstcategorydate"? See also Test date formatting. -- Gero 15:36, 26 February 2007 (CET)

....

Help with a complex request?

I have the following situation...

  • A) Many 'Template:' pages containing protected text derived from a third party (copyright requires 'verbatim' inclusion of the text).
  • B) Many normal pages that 'transclude' the template pages (based on page name).

i.e. some page = "Template: Subject X" and calling page = "Subject X". Calling page contains a {{{{PAGENAME}}}} construct to call the content from "Template: Subject X".

All the templates of A are in a Category (X) and all the normal pages of B are in a category (Y).

Now... ;-)

I want a DPL to list the 10 smallest normal pages from B ... but when I say 'smallest' I mean the smallest 'overall' pages, including the transcluded text from the companion template in A. This overall size is actually the sum of the size of page A and B. Now I figure I can calculate the overall page sizes using a template and the ... I was going to say {{PAGESIZE}} magic word... but I don't find it!

So basically I am stuck.

Is it possible? --Dmb 11:46, 3 June 2007 (CEST)

Question

What exactly what help you? Is there a table column in the sql database the value of which could serve as an input for your calculation? When DPL lists pages it does not look into their contents. When you ask DPL to do processing based on the contents of a page it will go straight forward for the exact purpose (i.e. look for a headline or a template invocation), but there is no inherent "page inclusion resolution" and no size calculation. Gero 12:53, 3 June 2007 (CEST)

Confusion about includematch

I have a task that I think should be perfect for DPL. On my company wiki, we have a template {{todo|username of who should do it|what should be done}}. I'd like to use DPL to show only the pages that have references to this template AND those tasks are assigned to a particular user. After reading the DPL manual, I thought that I should be able to use

<dpl>
    uses=Template:Todo
    includematch=SomeUserName
</dpl>

However, this seems to list all pages with calls to the template in does not filter based on the username. What's wrong with my method? Thanks in advance. --Gri6507 15:23, 25 July 2007 (CEST)

Try using includepage={Todo} in place of uses=Template:Todo. -Eep² 06:44, 26 July 2007 (CEST)
First, you must use something like 'include={Todo}.dpl'
Note the '.dpl' suffix (any other suffix would do as well). You must create an empty template named 'Template:Todo.dpl'. You could also write some code into that template, but that´s another story.
And then you must indeed use 'includematch'. But (as the manual says) we expect a 'preg' expression here, which means that you must specify something like 'includematch=/SomeUserName/'. If you have named parameters you must use a regexp which matches the parameter´s name as well as the '=' and surrounding spaces and the argument, of course. If you use unnamed parameters you can only hope that the pattern you are searching for does not occur somewhere else. Again, in both cases you MUST use 'preg' syntax, which means that you need delimiters around the regular expression. It is important to understand that the whole wikitext at the position where your template is called will be used for the match test. So you may use something like '/\|\s*username\s*\|/'. You must be very careful to escape the '|' characters as they have a special meaning within regular expressions. I did not test this, so you may need to experiment a little with escapings. If the wiki text author used a newline between the template parameters you need to make sure that your regexp also covers this.
I am really trying top help people here. As some kind of thank you it would be nice if you
  • put your wiki on the "wikis using DPL" list (although it may not be reachable for the public)
  • take your question and my answer and make a contribution in the DPL:FAQ from it.
  • Provide a small example to which the FAQ entry links where we can all study the problem.

o.k.?

Gero 15:32, 26 July 2007 (CEST)
Thanks for the help. I documented my usage in DPL:FAQ#Getting_pages_with_references_to_templates_with_particular_parameters. --Gri6507 13:58, 31 July 2007 (CEST)

Exclusion of Duplicate Pages

Let me start by saying - Cool extension! A fantastic and powerful addition to MediaWiki...

I have just started using DPL, so this question may very well be a result of ignorance. I have articles that are a part of multiple categories. For example, the "HOWTO: Install the Client" page is a part of the 'Client Solution Center' category, as well as the 'Installation' category. I use the following code to render all pages that are a part of the 'Client Solution Center' category, as well as to show what other categories those pages are a part of.


 <DPL>
  category=Client Solution Center
  ordermethod=category,pagetouched
  headingmode=H2
  mode=ordered
 </DPL>

The output is something like:

Client Solution Center
HOWTO: Install the client
Installation
HOWTO: Install the client

I was under the impression that the distinct parameter was implicitly true, and that it should stop the articles from being displayed twice. This does not appear to be the case. Am I doing something wrong, or not understanding this functionality correctly?

Appreciate the help and hard work!

209.139.229.17 16:51, 31 July 2007 (CEST)

Redirects to include pages that link to them?

<dpl>
linksto=DPL:Discussion
redirects=include
</dpl>

Like Special:Whatlinkshere/DPL:Discussion does (test redirect link to this page), I want an option for the redirects parameter to optionally list all pages that link to redirects as well (without having to manually specify all of them in the DPL statement). Is this possible with DPL and, if not, would you please add it? -Eep² 21:20, 31 July 2007 (CEST)

An example of the problems of manually trying to include all variations of a page with redirects via a template:


{{#dpl:
category=Games
|resultsheader=<h2>Games (%PAGES%)</h2>
|noresultsheader=No games have this attribute yet.
|linksto={{PAGENAME}}{{!}}{{PAGENAME}}s{{!}}{{PAGENAME}}es{{!}}{{PAGENAME}}ing{{!}}{{PAGENAME}}d{{!}}{{PAGENAME}}ed
|redirects=include
}}

Say the page is "cut scene" (with redirects from "cutscene" and "cut scenes"). Now, with this setup, if the page that has this DPL syntax on is "cutscene", then pages that link to "cut scenes", "cut scenees", "cut sceneing", "cut scened", and "cut sceneed" will all show up in the list, assuming the pages are in the "Games" category. However, the 2-word "cut scene" won't show up (unless I manually specify it, but this code is for a template). If DPL truly supported redirects as MediaWiki does, I wouldn't have to create all of these linksto variations...and I don't know of a way to programmatically take a root word and break it up into its syllables. -Eep² 12:51, 7 August 2007 (CEST)

I think the problem can be solved with nested DPL queries. Create an inner query which finds all the redirect pages (with redirect=only) to your target page(s) and an outer query which finds pages that link to the pages of the result set of the inner query. Apart from that you would have to add another query which finds the direct links to the target pages (using redirect=exclude). In essence this will do the same as the php code which tracks the redirects. C gives an example how to do it. Gero 20:41, 15 August 2007 (CEST)
Too complicated. Why can't "redirects=include" actually work intuitively and actually include redirects like it should? A single query should be able to output results like Special:Whatlinkshere does (without require obscure formatting too). -Eep² 05:34, 16 August 2007 (CEST)
Can't you just create a "redirects=full" parameter, or whatever, that will give all redirect options like Special:Whatlinkshere does? I really need this functionality for my wiki! -Eep² 16:49, 21 August 2007 (CEST)
Well? -Eep² 09:23, 24 August 2007 (CEST)


Fancy template filtering: is this possible?

I have some pages where I call the same template a number of times. On these pages I call a template that formats an extract from a web site and includes the name of the site and the URL.

Elsewhere I would like use DPL to list all the place where any given website is called via this template.

This appears on a page somewhere:

{{Web citation|
web link=http://www.google.com|
title=Google Home page|
date=June 29, 2006|
source=Google|
extract=What do you expect!}}

{{Web citation|
web link=http://www.yahoo.com|
title=Yahoo Home page|
date=October 12, 2006|
source=Yahoo|
extract=Another search engine}}

This template formats the passed output such that the parameter "source" is used as an internal wiki link. This would then let me have a page for "Google" and another for "Yahoo".

Elsewhere I'd like to find all the pages that have the source = Google.

I can already list every page that uses this template and this also lists all uses of the template on that page (so for this example I'd see both Google and Yahoo listed). I'd like to only include the uses of the template that link to Google. I'd like to put this on a page called Google so that this would then collect all references to Google across my site.

On a page with the Title "Google"

{{#dpl:categorymatch = % | linksto = {{FULLPAGENAME}} | includepage={Web citation} dpl2 }}

Is that clear? Any help would be much appreciated. DPL is fantastic, even if the learning curve is a little extreme.

Brianoflondon 20:11, 6 August 2007 (CEST)

Try notuses=Template:Yahoo but you'll need to have separate templates for Google and Yahoo in order for DPL to include one (Google) and not the other (Yahoo), in this case. I don't think DPL supports notlinksto for external URLs, but I haven't tried. -Eep² 12:57, 7 August 2007 (CEST)

#DPL reminder

When using DPL with the parser function form, keep in mind that *all* arguments that contained the pipe character “|” should be transformed into a "special" pipe “¦”. Especially the category match parameters, where I tend to forget about this rule of thumb. Using the debug level when testing should be a good idea, too. - 82.249.32.133 16:16, 16 August 2007 (CEST)

all namespaces

How do I get a list of all namespaces? -Eep² 12:46, 29 August 2007 (CEST)

Answer

Unfortunately there is no built-in way for that. You could create a page with identical name in each namespace and call it, say, 'About this namespace'. A DPL query with a titlematch on that name would then deliver exactly all these pages. Using the %NAMESPACE% variable you get the list you want. Not really nice, though ... Gero 13:22, 29 August 2007 (CEST)

Well, don't you think DPL should be able to do that inherently like it can with categories and pages? -Eep² 13:29, 29 August 2007 (CEST)

Show Articles in one Category by Sortkey

I just created these 3 Articles which are categorized in a different order than the title names:

{{#dpl:category=VolkoV}}

How is is possible to sort the Articles in the categorized order?--VolkoV 18:37, 31 August 2007 (CEST)