Difference between revisions of "DPL:FAQ"
(→B) The same table of page meta-data using the 'table' parameter;: I lied) |
(→C) A table of page template and or section data) |
||
Line 220: | Line 220: | ||
I wish I knew how to do this... | I wish I knew how to do this... | ||
− | === C) A table of page template | + | === C) A table of page section or template data; === |
See [[Test table]]. | See [[Test table]]. |
Revision as of 01:38, 17 September 2007
Contents
- 1 My article name contains underscores, but in the DPL result they won´t appear.
- 2 When I use multi-column output my background color is cluttered
- 3 I try to generate table formatting with DPL but it looks weird - to hell with the syntax!
- 4 Getting pages with references to templates with particular parameters
- 5 Inserting spaces and comma in the output
- 6 Why does my deleted page still appear on Special:Wantedpages?
- 7 Why does my deleted page still have a link to a query page in its What Links Here list?
- 8 How do I 'see' the wikitext my DPL generates?
- 9 How do I offset an orderd list by a certain number?
- 10 How do I create tabular output?
My article name contains underscores, but in the DPL result they won´t appear.
Normally, DPL replaces all undercores in article names by spaces when showing the result. You can replace underscores by their symbolic html name via the 'replaceintitle' statement. So DPL will no longer recognize the underscores and later the html engine will translate the symbolic name to underscores.
This wiki contains an Article_with_underscore. Normally DPL would show it as . But with {{#dpl:titlematch=%underscore|replaceintitle=/ /,_}} you will getWhen I use multi-column output my background color is cluttered
There is a special parameter named rowcolformat which allows to set the background color, cell-spacing etc. in combinaton with 'columns=' or 'rows='. See also DPL:Requests_for_new_features_Archive#Global background-color.
I try to generate table formatting with DPL but it looks weird - to hell with the syntax!
Indeed, complex queries can be somewhat tricky. But this is not only a problem of DPL. MediaWiki is quite sensitive to blanks and linefeeds and half of your problems will probably come from there.
There is a simple trick how you can DEBUG your DPL script:
Use a resultsheader and a resultsfooter to enclose all DPL output in pre/nowiki tags like this:
<dpl> resultsheader=<pre><nowiki> resultsfooter=</nowiki></pre> titlematch=Nig% include=%1[300] format={|class=wikitable\n!article\n!beginning\n|-,\n[[%PAGE%|%TITLE%\n,\n,\n|} </dpl>
If we execute the above query (without the debug header/footer) the result will be deeply unsatisfactory:
article | beginning |
---|
But why?
With our little trick we can watch the output of DPL which would normally be immediately rendered by the wiki parser:
{{Extension DPL}}{|class=wikitable !article !beginning |- [[Nig1|Nig1]] [[Nig2|Nig2]] [[Nig3|Nig3]] [[Nig4|Nig4]] [[Nigunda Test|Nigunda Test]] Nigunda Test History - Chapter Sequence in the article doesn´t matter for DPL .. [[Nigunda|Nigunda]] some facts about religious groups in Nigunda; some other facts about religious groups in Nigunda; [[Category:Tag_Event2]] [[Nigeria|Nigeria]] :<div class="noprint">''Main article: [[History of Nigeria|History of Nigeria]]''</div> :<span class="boilerplate seealso">''See also: [[:Nigerian military juntas of 1966-1979 and 1983-1998|Nigerian military juntas of 1966-1979 and 1983-1998]]''</span> More than 2,000 years ago. the [[Nok]] [[Nigeria#History|..→]] |}
And now we see: After the |- the next table row does not start with a '|'; and, apart from that, there is no "end of row" after each article. Now it is easy to correct the DPL query:
<dpl> titlematch=Nig% include=%1[300] format={|class=wikitable\n!article\n!beginning\n|-,\n|\n[[%PAGE%|%TITLE%]],\n|-,\n|} secseparators=\n|\n, </dpl>
.. and we get the desired result:
article | beginning |
---|---|
Nigunda Test History - Chapter Sequence in the article doesn´t matter for DPL .. | |
some facts about religious groups in Nigunda; some other facts about religious groups in Nigunda; | |
In our "debugger" it looks like this:
{{Extension DPL}}{|class=wikitable !article !beginning |- | [[Nig1|Nig1]] | |- | [[Nig2|Nig2]] | |- | [[Nig3|Nig3]] | |- | [[Nig4|Nig4]] | |- | [[Nigunda Test|Nigunda Test]] | Nigunda Test History - Chapter Sequence in the article doesn´t matter for DPL .. |- | [[Nigunda|Nigunda]] | some facts about religious groups in Nigunda; some other facts about religious groups in Nigunda; [[Category:Tag_Event2]] |- | [[Nigeria|Nigeria]] | :<div class="noprint">''Main article: [[History of Nigeria|History of Nigeria]]''</div> :<span class="boilerplate seealso">''See also: [[:Nigerian military juntas of 1966-1979 and 1983-1998|Nigerian military juntas of 1966-1979 and 1983-1998]]''</span> More than 2,000 years ago. the [[Nok]] [[Nigeria#History|..→]] |- |}
Getting pages with references to templates with particular parameters
Let's say that your company uses a wiki to assign and keep track of tasks. So, let's say that you have created a todo template which, as a parameter, takes the name, username, or some other semblance of a name of a person responsible for the task. Then, you could use something like
<dpl> uses=Template:Todo2 include={Todo2}.dpl includematch= /\|(First Last)|(Last)|(FLast)/i </dpl>
which produces
Extension:DynamicPageList (DPL), version 3.2.1: Warning: No results.
- What the hell is going on here! This example explains nothing! --Dmb 22:04, 15 September 2007 (CEST)
Inserting spaces and comma in the output
Just use the numeric html alias for comma: ,; you may want to have a space after that 'comma', so line wrapping will work normally:
{{#dpl:category=MyItems|listseparators=,[[%PAGE%|%TITLE%]], ,,}}
Why does my deleted page still appear on Special:Wantedpages?
When a page is categorized such that it appears in a DPL query and is subsequently deleted, it will immediately disappear from the DPL query results. However, depending on how long the page has been around, it will temporarily still appear on Special:Wantedpages and navigating to the page's What Links Here page will still show the DPL query page as a page that links to it.
To get it to stop that unruly behavior, do one of the following:
- Wait awhile. Gero suggested an hour. The wiki will sort this out over time.
- Run runJobs.php, in the maintenance folder of your MediaWiki installation
- Open the DPL query page in edit mode and save it again (this will add to your Recent Changes page)
- Add reset=all in a final DPL query on the query page (see here.) This has other side effects - read about it first.
--Aaron Overton 21:08, 2 September 2007 (CEST)
Why does my deleted page still have a link to a query page in its What Links Here list?
The answer to this is already in the previous section, but we wanted you to be able to find your question anyway.
How do I 'see' the wikitext my DPL generates?
There is a simple trick to DEBUG your DPL script:
Use a resultsheader and a resultsfooter to enclose all DPL output in pre and nowiki tags like this:
<dpl> resultsheader=<pre><nowiki> resultsfooter=</nowiki></pre> ... </dpl>
- Better yet, integrate this into a debug option so this is automatic... -Eep² 22:16, 15 September 2007 (CEST)
How do I offset an orderd list by a certain number?
For the DPL I can't work it out... is it one of the attr arguments? Which one?
In theory it is possible...
<ol start="4"> <li>List 2 item #1</li> <li>List 2 item #2</li> <li>List 2 item #3</li> </ol>
Which gives
- List 2 item #1
- List 2 item #2
- List 2 item #3
How do I create tabular output?
The answer is (surprisingly) quite simple. There are a several of different methods depending on the data you want. Example A) and B) below return page 'meta-data'. Example C) below returns data on the page itself, either from within specific page sections or from templates used on the page.
A) A table of page meta-data;
The 'parser function' syntax of the DPL ({{#dpl:...) gives the cleanest looking code, and is used below for that reason. However, the regular <DPL> syntax works in an identical way but with different layout.
{{#dpl: |category = Country |count = 10 |mode = userformat |addauthor = true |addpagesize = true |addpagecounter = true |addfirstcategorydate = true |userdateformat = d-m-Y |listseparators = {¦ class="sortable" \n! \n! Date \n! Name \n! Author \n! Views \n! Size \n¦-, \n¦ align="right" ¦ %NR% \n¦ align="right" ¦ %DATE% \n¦ align="left" ¦ [[%PAGE%]] \n¦ align="left" ¦ [[User:%USER%¦%USER%]] \n¦ align="right" ¦ %COUNT% \n¦ align="right" ¦ %SIZE% B, \n¦-\n, ¦} }}
Gives;
Date | Name | Author | Views | Size | |
---|---|---|---|---|---|
1 | 02-09-2007 | Nig1 | Gero | %COUNT% | 166 B |
2 | 02-09-2007 | Nig2 | Gero | %COUNT% | 166 B |
3 | 02-09-2007 | Nig3 | 67.41.66.71 | %COUNT% | 174 B |
4 | 03-09-2007 | Nig4 | 67.41.66.71 | %COUNT% | 198 B |
5 | 05-09-2007 | Category:CountryA | 67.41.66.71 | %COUNT% | 301 B |
6 | 05-09-2007 | Category:CountryB | 67.41.66.71 | %COUNT% | 301 B |
B) The same table of page meta-data using the 'table' parameter;
I wish I knew how to do this...
C) A table of page section or template data;
See Test table.