Utente:Wedhro/Sandbox/Aiuto:DPL

Versione del 20 lug 2017 alle 11:16 di Wedhro (rosica | curriculum) (Creata pagina con ''''Questa è una guida avanzata all'uso dei DPL''' che ci vorrà un bel po' a finire perché è complicata. Ci sono parti in inglese perché devo ancora finire di tradurla, e ...')
(diff) ← Versione meno recente | Versione attuale (diff) | Versione più recente → (diff)
Vai alla navigazione Vai alla ricerca

Questa è una guida avanzata all'uso dei DPL che ci vorrà un bel po' a finire perché è complicata. Ci sono parti in inglese perché devo ancora finire di tradurla, e manca ancora un sacco di roba che devono trovare.

Mode

 {{#dpl:
 |mode = MODALITÀ
 }}
 

unordered

È la modalità preimpostata.

none

Elenco non puntato.

ordered

Elenco puntato.

none

Elenco non puntato.

inline

I risultati sono messi in linea, senza andare a capo.

 {{#dpl:
 |mode = inline
 |inlinetext = SEPARATORE
 }}
 

Separatore è un qualunque wikitesto che sarà usato per separare i risultati messi in linea. Se non specificato, è  - , ovvero un trattino separato da spazi.

NB: gli spazi all'inizio e alla fine del wikitesto sono ignorati, per quello bisogna usare i codici HTML per gli spazi.

category

Elenco formattato come una pagina di categoria, quindi con risultati incolonnati e divisi in ordine alfabetico. Il parametro ordermethod è obbligatorio.

userformat

Risultati formattati secondo indicazioni date, il che permette risultati sofisticati come tabelle ecc.


mode 'Userformat'

listseparators

Template:DPL parameter Note that format= automatically implies mode=userformat whereas listseparators does not.

format

Template:DPL parameter

Note1: listseparators is an alias for format which does not automatically imply mode=userformat.

Note2: the format command is very flexible but somewhat complicated. If you want to create tabular output, you should have a look at the table command.

Syntax:

format=Startall,Start,End,Endall

'Startall', 'Start', 'End' and 'Endall' are wiki tags used to separate the list items.

  • 'Startall' and 'Endall' define an outer frame for the whole list.
  • 'Start' and 'End' build an inner frame for each article item.

Because wiki syntax depends on newline characters the string \n must be used to explicitly insert newline characters into the output.

As we want to be able to control output completely we reference article names and other possible output by special symbols:

  • %NR% = the current article sequence number (starting from 1)
  • %PAGE% = the name of the article (including namespace)
  • %PAGEID% = the internal unique numeric ID of the arcticle page
  • %IMAGE% = the physical path to an image (based on hash values, e.g. 5/5d/myImage.jpg)
  • %PAGESEL% = the name of a page which was used within the selection criteria (only applies to linksfrom and linksto)
  • %IMAGESEL% = the name of an image which was used within the selection criteria (only applies to imageused)

  • %TITLE% = the title of the page (without the namespace)
  • %NAMESPACE% = the namespace of the page

  • %COUNT% = the usage counter (requires addpagecounter=true)
  • %SIZE% = the article size (requires addpagesize=true)
  • %SIZEFS% = a font size number which is based on the article size (logarithm of square root of counter)
  • %COUNTFS% = a font size number which is based on the usage counter (currently this is the logarithm of the usage counter)
  • %COUNTFS2% = similar to %COUNTFS%, but based on the logarithm of the square root of the usage counter.
  • %EDITSUMMARY% = the change log message of a revision; only accessible if the DPL query is based on revisions.

  • %DATE% = the date selected, eg. lastedit; requires addeditdate=true or similar; the formatting of the date can be influenced using userdateformat=
  • %USER% = the user who changed the document last; requires adduser=true

  • %CONTRIBUTOR% = the user who made a contribution; requires addcontribution=true
  • %CONTRIBUTION% = the number of bytes changed; requires addcontribution=true
  • %CONTRIB% = an asterisk bar to indicate the amount of change; requires addcontribution=true

  • %CATLIST% = a pipe-separated list of links to all categories to which the article belongs (requires addcategories=true)
  • %CATBULLETS% = a bullet point list of links to all categories to which the article belongs (requires addcategories=true)
  • %CATNAMES% = a comma-separated list of all categories to which the article belongs (requires addcategories=true)

  • %REVISION% = the name of the revision of the article; this will only be available if you made a selection based on revisions

  • %EXTERNALLINK% = the external hyperlink found as a consequence of the linkstoexternal statement

These symbols will be replaced by the corresponding values if they occur within 'Start' or 'End' or within the corresponding tags of the secseparators= parameter.


In addition there are some symbolic variables which can ONLY be used in resultsheader and resultsfooter:

  • %PAGES% = number of articles in the result set
  • %TOTALPAGES% = total number of articles in the result set, regardless of count limits; will only be calculated if used.
  • %VERSION% = the current DPL version

  • %DPLTIME% = contains the amount of time (in seconds + milliseconds) spent within DPL; this can be helpful if you observe slow response times for wiki pages that contain DPL statements. Example: 2 (2009/06/13 09:27:43) would mean that DPL spent two seconds of the whole response time, starting at the time given in brackets.

  • %FIRSTNAMESPACE%, %FIRSTTITLE%, %LASTNAMESPACE%, %LASTTITLE% : These variables contain namespace and title of the first / last articel in the result set; the information is intended to be used for page scrolling
  • %SCROLLDIR% : The value of this variable is set by the URL parameter DPL_scrollDir. It is passed to the scroll helper template which uses it to produce its links for scrolling.


For example the classical default output of DPL2 can also be produced with the following statements:

Example:

<DPL>
  category = Africa
  format   = ,\n* [[%PAGE%|%TITLE%]],,
</DPL>

Note that a bullet point list in wiki syntax is defined by a "*" at the beginning of a line -- therefore we have to use a special symbol '\n' or '¶' to refer to the beginning of a new line of wiki text. Replace the "*" by a "#" and you will get a numbered list. 'Startall' and 'Endall' are empty (note that we start with a comma, note the two commas at the end), the 'Start' tag is used to create a new line with an initial "* " followed by the page name, written as a link. That´s all.

Creating a top-five hitlist with access rates and bold article names of varying size could be done like this:

<DPL>
  category       = Africa
  ordermethod    = counter
  order          = descending
  addpagecounter = true
  count          = 5
  format         = ,\n%COUNT%  --- <font size="%COUNTFS%">'''[[%PAGE%]]'''</font>,<br/>,
</DPL>

You can also use HTML syntax for the tags, although this is discouraged.

<DPL>
  linksto        = Africa
  format         = <ul type="disc">,<li>[[%PAGE%]],</li>,</ul>
</DPL>

Now let us create a table using wiki syntax:

<DPL>
  linksto        = Africa
  format         = {| class="wikitable"¶!pages found,¶|-¶|[[%PAGE%]],,¶|}
</DPL>

We use 'Startall' to define the table header and 'Endall' for the footer. Each article is presented in a table row using wiki syntax for table layout.

we could also produce image galleries:

<DPL>
  namespace = Image
  format    = <gallery>,%PAGE%\n,,</gallery>
</DPL>

secseparators

Template:DPL parameter

Syntax

secseparators=Start1,End1,Start2,End2,..,..

or

secseparators=Start

Please note that the semantics of this parameter have changed with version 0.9.6!. When upgrading to 0.9.6 it will probably be necessary to change the secseparator statements.

In the first syntax variant, specify pairs of tags which correspond to the includepage statement. StartN and EndN are HTML strings or wiki tags which will be put around each transcluded section (see includepage=name1,name2,...).

In the second syntax variant, specify just one element which will then be used as 'StartN' for all sections; in this case the second tag (EndN) will be empty for all transcluded sections.

Symbolic replacements of %PAGE% etc. take place as described in listseparators. In addition, the symbol %SECTION% can be used to refer to the section found (works only for chapter headings).

If the same section occurs more than once in an article (or an article includes the same template more than once) all such occurences will be transcluded as a block and the secseparator tags will only be put once around the whole block (but see dominantsection).

Example

<DPL>
  linksto        = Africa
  mode           = userformat
  listseparators = {|¶!pages found¶!fruit¶!color,¶|-¶|[[%PAGE%]],,¶|}
  includepage    = #fruit,#color
  secseparators  = ¶|,,¶|,,
</DPL>

Which produces,

pages found fruit color
10.000 a.C. (film)
100 peggiori film di tutti i tempi
10 novembre
11 giugno
1848
1861
1897
1935
1940
1941
1962
1988
1997
1 d.C.
21 settembre
23 luglio
29 aprile
29 novembre
7 ottobre
8 settembre
9 magosto
A
AIDS
Nonnotizie:A 11 anni esordisce in Premier League e segna
Abu-Bakr Al Baghdadi
Nonnotizie:Accordo tra CAI e sindacati Alitalia
Ace Ventura
Acqua
Template:Africa
Africa settentrionale
Afroitaliano
Al Qaeda
Albert Wesker
Alcide De Gasperi
Alessandro Barbero
Utente:Alex48/Centro stoccaggio progetti in decantazione
Amedeo Guillet
America
Americano medio
Amon Amarth
Analfabbetismo
Andria
Angelina Jolie
Anglosassoni
Anni 1940
Anni 1980
Annibale
Nonciclopedia:Anteprime/1897
Nonciclopedia:Anteprime/Afroitaliano
Nonciclopedia:Anteprime/Americano medio
Nonciclopedia:Anteprime/Australopithecus
Nonciclopedia:Anteprime/Età imperiale di Roma
Nonciclopedia:Anteprime/Homo erectus
Nonciclopedia:Anteprime/Pigmei
Nonciclopedia:Anteprime/Vuvuzela
Antonio Banderas
Arca dell'Alleanza
Aria fritta
Army of Two
Asia
Australopithecus
Austria
Babaman
Balista ad aria
Bambino soldato
Banana Yoshimoto
Banca
Barbarossa (film)
Nonsource:Barzellette sui bianchi
Nonsource:Barzellette sui negri
Basilicata
Basket
Bastardo
Battaglia di Lepanto
Battaglia di Santiago
Battaglia di Waterloo
Belgio
Benin
Beppe Grillo
Bernardo Corradi
Beyoncé Knowles
Bhutan
Big Babol
Bimbominkia fascista
Utente:Black Out/Hitler e l'impero dei Nazi robot
Blues
Bob Marley
Bokassa I
Bonobo
Brianza
Bruno Tabacci
Burkina Faso
CIA
Caccia alla volpe
Portale:Calcio/Articoli
Caligola
Caltagirone
Caltanissetta
Calvizie
Camerun
Campagna d'Africa
Campionato del mondo endurance FIA
Campionato mondiale di calcio 1930
Campionato mondiale di calcio 1950
Campionato mondiale di calcio 1982
Campionato mondiale di calcio 2006
Campionato mondiale di calcio 2010
Campionato mondiale di calcio 2022
Canadafrica
Canale di Suez
Capodanno
Capri
Nonbooks:Caricare un'immagine su Wikipedia
Caritas
Carlo V del Sacro Romano Impero
Casa Savoia
Cassio Dione
Castel dell'Ovo
Catoblepa
Cerco casa disperatamente
Chaac
Chef (South Park)
Chi vuol essere milionario?
Utente:Chiavettomane(?)/Sandbox2
Chirurgia estetica
Chitarra
Christiaan Barnard
Chuck Schuldiner
Ciad
Ciccio Bombolo Cannoniere
Ciccione
Ciclo della Fondazione
Nonciclopedia:Cimitero/Template
Nonnotizie:Clandestini all'attacco dei manifesti della Lega Nord
Clash of Clans
Nonbooks:Classificazione dei clienti del benzinaio
Claus Schenk von Stauffenberg
Cobra
Cocomero
Coinquilino
Colobo
Come te nessuno mai
Command & Conquer: Generals
Compagno di banco
Complesso emergente pugliese
Continente
Contrabbandiere
Cordone ombelicale
Cose che il governo vuole che tu creda
Cosmogonia
Costa Crociere
Costa d'Avorio
Creature di Fallout 3
Utente:Cresh./ADS/Homo erectus
Utente:Cresh./ADS/Vuvuzela
Cristoforo Colombo
Cucina zanzibari
Cécile Kyenge
Nonciclopedia:DPL/Processi/Pagine assolte
Damian Marley
Darfur
Dario Franceschini
De bello civili
Dead or Alive (videogioco)
Deluso di sinistra
Deriva dei continenti
Desert Eagle
Dichiarazione universale dei diritti umani
Nonbooks:Diventare un bioterrorista
Nonbooks:Diventare un dittatore
Divino Otelma
Divisione XMAS
Documentari di Pasolini del 1970
Dodicimillesima voce di Nonciclopedia
Utente:Don Fano
Drago
E.R. Medici in prima linea
ESwatini
E venne il giorno
Ebete
Ebola
Ebreo
Effetto serra
Egitto
Utente:ElGhislo
Elefante
Elisa
Emma Bonino
Ennio Flaiano
Nonnotizie:Entra in banca e si fa cambiare i soldi del Monopoli
Equatore
Ernest Hemingway
Erwin Rommel
Esercito Italiano
Esercito del male
Eterocefalo glabro
Etna
Età del bronzo
Età della pietra
Europa
Ex ragazza
Utente:Executive2/Sandbox3
Extracomunitario
Extraterrestre
FAO
FIFA
Fabrizio Miccoli
Famiglia Bonduelle
Far Cry 2
Fatti su Chuck Norris (15)
Fatti su Chuck Norris (17)
Fatti su Chuck Norris (2)
Fausto Coppi
Ferdinando Magellano
Ferrovia
Fiat Palio
Fintoreggae
Utente:Flaming Ace/Sandbox/1
Fontana
Fornaio
Francesco Petrarca
Fratelli Gracchi
Friday Night Funkin
Fucile da pesca
Utente:Fulmin/Sandbox/Sandbox
Utente:Fulmin/Sandbox1
Utente:Funcool88/Sandbox
Gabon
Gautama Buddha
Gazzella negrivora
Genesi
Nonbooks:Genocidio
Gente che per strada cerca di spillarti i soldi
Geografia
Portale:Geografia/Africa
Portale:Geografia/Europa
Portale:Geografia/Popolo
George Clooney
Gibuti
Gintama
Giorgio Almirante
Nonnotizie:Giorno della collera in Libia
Giosuè
Giovanni Giolitti
Giovanni Paolo I
Giraffa
Giza
Gnu
Golden Axe (serie)
Gomito
Gommone
Utente:GorillaK2/Zebraismo
Grande Fratello (programma televisivo)
Grecia
Grifone
Guardia Nazionale Italiana
Guerra civile libica
Guerra civile spagnola
Guido Bertolaso
Guido Nicheli
Nonnotizie:Guidonia, in trappola il branco di violentatori
Hailé Selassié
Hermione Granger
Hetalia: Axis Powers
Hidetoshi Nakata
Hit ball
Nonsource:Hitler e l'Impero dei Nazi Robot
Hollywood
Homo erectus
Homo sapiens
Nonquote:Horatio Caine
Ibrahim Ba
Idi Amin Dada
Il senso della vita
Immanuel Kant
Imperivm
Impero romano
Incubi e deliri
Inglesi
Insulto
Invasione aliena
Invasioni barbariche
Invidia del pene
Ipocondria da Wikipedia
Italia
Ius soli
Ivrea
James Cook
John Quincy Adams
Johnny Groove
José Luis Rodríguez Zapatero
Jugoslavia-Zaire 9-0
Kenya
Krusty il Clown
Kunta Kinte
Utente:L'Imperatore/Inventario
Utente:L'Imperatore/Sandbox6
L'arte della guerra
Nonnotizie:L'artiglieria nordcoreana non vuole dormire
La grande bellezza
Ladro
Lama
Nonciclopedia:Latrina
Nonciclopedia:Latrina/Novità
Nonciclopedia:Latrina/Votazioni/Registro 2016-10-30
Nonciclopedia:Latrina/Votazioni/Registro 2017-01-22
Nonciclopedia:Latrina/Votazioni/Registro 2017-07-16
Nonciclopedia:Latrina/Votazioni/Registro 2018-04-30
Lattina
Laura Boldrini
Lazio
Legge Bossi-Fini
Leggi della fisica poliziesca
Legione straniera
Lei Wulong
Leopardo planante Leopardo
Lesotho
Nonciclopedia:Lettere alla Redazione
Lev Trotsky
Libia
Licaone
Lingua egizia
Liverpool Football Club
Logorrea
Loredana Berté
Lotta greco rumena
Lucia Annunziata
Lucio Anneo Seneca
Lucio Sergio Catilina
Ludovico Ariosto
Luftwafer
Lugano
Utente:MFHbot/Statistiche/2006
Maciste
Madagascar
Madonna Nera
Magia
Utente:Magneto93/Sandbox
Mali
Malta
Mammuth
Template:Mapbanner
Marche
Marco Porcio Catone
Utente:Marco campa/Sandbox/Chaac
Utente:Marco campa/Sandbox/Dimostrazione che i cristiani sono pagani
Utente:Marcopete87/Sandbox
Margaret Thatcher
Margherita di Savoia
Marocco
Martin Luther King
Massa (comune)
Nonnotizie:Mastella in fuga dalla Campania
Utente:Mattia Bosio/Sandbox
Mellivora capensis
Menhir
Messina
Metal Gear
Michael Schumacher
Utente:Mickhead/Sandbox
Migrante
Mio cuggino
Utente:Mirkana/Sandbox
Missione di pace all'estero
Mokele Mbembe
Mostro degli Spaghetti Volante
Mulino Bianco
Mulino Nero
Multinazionale
NASCAR
Nadia - Il mistero della pietra azzurra
Napoli
Necrofagia
Negreria
Nelson Muntz
Nicklas Bendtner
Nicolas Eymerich
Nigeria
Nilo
Ninki Nanka
Nintendo
Noia da Chuck Norris
Non aprite quella porta 3d (film 2013)
Cimitero:Nonciclopedia:Tribunale/Archivio/13
Utente:Nonciclopediologo/Link
Utente:Nonciclopediologo/Makelist/1
Utente:Nonciclopediologo/Pagina Utente
Nonnonegro
Categoria:Notizie Africa
Noè
Nunzio apostolico
Oasis
Obsolescenza programmata
Occidente
Oceania
Olbia
Olio di palma
Omero
Orango
Ordine economico mondiale
Nonbooks:Organizzare un funerale
Organizzazione delle Nazioni Unite
Ornitorinco
Otto Von Tèttete
Ottone I
Pablo Diego José Francisco de Paula Juan Nepomuceno María de los Remedios Cipriano de la Santísima Trinidad Martyr Ruiz y Picasso
Padania
Paganesimo
Nonvoyage:Pagina principale
Palafitta
Panchinaro
Pandemia
Panic! at the disco
Pantera nera
Papa Benedetto XVI
Partito Democratico (Italia)
Paula Rego
Pene d'ebano
Penny Dreadful (serie televisiva)
Phacochoerus africanus
Piemonte
Piero Angela
Piero Pelù
Pigmei
Pirla
Politica
Polo Sud
Polpo Paul
Porcellana
Poteva andare peggio
Pray station
Nonbooks:Preparare un bicchiere d'acqua
Prescrizione
Prete moderno
Prete obeso
Schizzo:Prigozhin
Proboscide ripiena
Professore
Cimitero:Progetto:Sorveglianza/DPLMonitor/A
Psicoanalisi
Pubblico di Forum
Publio Ovidio Nasone
Publio Terenzio Afro
Puttana
Puttana di alto bordo
Utente:Puzza87/Adozioni a distanza
Qualcun altro
RPG
Radici (romanzo)
Ragusa
Rana del Gondwana
Rangiku Matsumoto
Rayman
Razza (biologia)
Nonnotizie:Reincarnazione di Michael Jackson
Relativismo
Repubblica Democratica del Congo
Repubblica Dominicana
Resident Evil 5
Ricercatori Infasil
Rievocazione storica
Rinoceronte
RisiKo!
Schizzo:Riso
Risorgimento
Rita Dalla Chiesa
Roberto Benigni
Roberto Calderoli
Roberto Saviano
Roccocò
Rockets
Utente:Rum e pera/Terza guerra mondiale
Rutilismo
Nonnotizie:SOS da due barconi tra Italia e Malta
Sahara Occidentale
Nonbooks:Saldare il debito pubblico
Santi d'Argento
Sardegna
Schiavo
Sciapode
Nonnotizie:Scoperta ragazza con quattro reni
Nonbooks:Scrivere un romanzo storico ambientato in età romana
Se la merda fosse oro
Sebastian Giovinco
Sedi del politecnico di Milano
Selena Gomez & The Scene
Sesso prematrimoniale
Seychelles
Sicilia
Silvio's Facts
Silvio Baldini
Sindrome dell'indicazione fuorviante
Sirena
Nonsource:Soluzioni alla crisi economica
Somalia
Utente:SorroW/Sandbox
Utente:SpinDario95/Sandbox
Splinter Cell: Double Agent
Spritz
Spyro

Use listseparators to define a table with three columns and put a link to the article in the first column of each row. Use secseparators to add more columns for each section found. There are two pairs for each transcluded section; the first element of each pair is a linefeed and a pipe (which define a new column in the table) and the second element of each pair is empty. Have a careful look at the '¶' symbols ('\n' can be used as an alternative). They always appear before a wiki syntax element which must be placed at the beginning of a new line. Thus, make sure that the wiki parser will understand them. Note: if an article does not contain a section named "fruit", it will result in an empty cell in the table.

As mentioned above, a single element can be used in the secseparators statement in order to apply this as a start tag to all transcluded sections; so it could have also been written:

Example 2

<DPL>
  linksto          = Africa
  mode             = userformat
  listseparators   = {|\n!pages found\n!fruit\n!color,\n|-\n|[[%PAGE%]],,\n|}
  includepage      = #fruit[50],#color[100 more..]
  secseparators    = \n|
</DPL>

Assuming that the chapters on fruit and color contain long texts, they can be truncated to 50 or 100 characters. A link which refers directly to those chapters will be generated automatically if needed.

multisecseparators

Template:DPL parameter

Syntax:

multisecseparators=sep1,sep2,...

The tags correspond to the transcluded section (see includepage=name1,name2,...).

Symbolic replacements of %PAGE% etc. take place as described in listseparators. In addition the symbol %SECTION% can be used to refer to the section found (works only for chapter headings). It will give you the precise name of each heading even if you used a regular expression (double ##) in the include statement.

If an article uses the same template more than once you will get all references with "sepN" as a separator.

Example:

<DPL>
  category=TestSSt
  includepage={interfaces_overview} dpl
  mode=userformat
  listseparators=¶{|class=sortable ¶!Interface ¶!Source system ¶!Target system ¶!Technology,¶|-¶|[[%PAGE%]] ¶,¶,¶|}
  secseparators  = \n|
  multisecseparators=¶|-¶|&nbsp;|
</DPL>

See also Test article structure.

dominantsection

Template:DPL parameter

Syntax:

dominantsection=number between 1 and the number of arguments in your includepage= statement

If there is only 0 or 1 piece of contents for the dominant section you will see no difference from normal DPL behaviour.

Example:

See the explanations at the top of this document to understand the meaning of dominantsection.

Note: Using dominantsection together with table may lead to strange result formatting.

Generating tabular output

table

Template:DPL parameter

Syntax:

table= tableatr, linkheader, (column headlines) ..

The table statement is a shortcut which implicitly sets certain values for other DPL parameters, namely mode, listseparators / format, secseparators, and multisecseparators.

The layout is less flexible than the individual use of all of the above parameters but will probably be sufficient in many cases, especially when used together with tablerow.

If you use table in a DPL statement, it does not make sense to use one of the other options mentioned because their values will be overwritten without notice. There is one exception of this rule: It can make sense to specify the THIRD argument for format in combination with table. Therefore this parameter is NOT overwritten by the table command. The third argument can be used to output meta data like %COUNT%, %USER% etc. as columns in an output table. If you want to do so, the third parameter must contain wiki syntax for output columns like this:

include = {some template}:parm1,#some heading
table   =,,tplparm,chapter,#hits
format  =,,\n%COUNT%

Do not forget to escape the '|' symbol if your DPL statement uses parser function syntax. You will get a table which contains template parameters, chapter contents and the usage counter as a third column. Meta data can only be placed AFTER normal contents as we use the THIRD parameter of the format statement.

The use of table requires an include statement which should, for reasons of readability, directly precede the table statement). Each argument of the include statement will produce one or more columns in the output table described in the table statement.

table expects a comma-separated list of parameters:

  • The first parameter will be used to describe general parameters for the table
    • it is recommended to make a CSS reference here, using something like class=wikitable or class=mytable if mytable is defined in the Mediawiki:Common.css document.
    • class=wikitable is the default value. Use double-quotes to specify multiple classes, e.g., class="wikitable sortable".
  • The second parameter is the headline for the first column.
    • The first column will automatically contain a reference to the article, so something like Article should be o.k.
    • Article is the default value.
    • if you use a single - (dash), the column with the hyperlink to the article will be suppressed. You can supply a hyperlink to the article in any other column if you use [[{{{%PAGE%}}}|{{{%TITLE%}}}]] within a phantom template.
  • All subsequent parameters are column headings which correspond to the arguments of the include parameter. Note that if you call a phantom template (like {Some Template}.dpl) in the include statement, you will have to provide as many headlines as the phantom template produces columns.
  • mode will be set to userformat
  • listseparators will be configured to produce wiki syntax which defines a table
  • secseparators will be configured to produce wiki syntax which creates a table row. The first column will always contain a hyperlink to the article of the query result (except you set the link header to '-' as described above.
  • multisecseparators will be configured to produce wiki syntax which creates another table row for multiple occurencies of the first include argument. For all other arguments a linebreak will be used if we are dealing with template parameters and a horizontal separation line will be used when dealing with chapter contents. The background for this is the following: If you have an article which calls the same template several times, you may want to have a table where each template invocation becomes a row in your table.

When using phantom templates (i.e. templates which are called during DPL execution instead of the original template) they must be written to produce output according to wiki table syntax. When entering such a template we are already at the beginning of a column (i.e. a preceding line with a | has already been put into the output stream). So start directly with the contents of the first column. To add more columns use a | in a separate line. Example:

   some output for the first column: {{{1|}}}
   |
   some output for the next column: {{{2|}}}
   |
   some output for the next column: {{{3|}}}

It may sound complicated, but is a huge improvement compared to the native use of mode, listseparators, secseparators and multisecseparators.

A typical DPL statement using the table parameter would contain:

include =                          #Chapter X,{T1}:parm1,#Chapter Y,{T2}.dpl
table   = class=sortable, Article,      X    ,     t-p  ,     Y    , T2-a, T2-b
 

Note that we have written the above statement in a way to show the correspondence between include and table. You can see the first two parameters which define the table characteristics and a headline for the hyperlink to the article. Then follow headlines for each argument of include. Note that there are TWO headlines which correspond to the last argument of the include statement (assuming that Template:T2.dpl outputs TWO columns). Template:T2 itself might have more or less than 2 arguments -- it only matters how many columns are output by Template:T2.dpl).

Now look at the examples

tablerow

Template:DPL parameter

Syntax:

tablerow= coldef, ..

Where coldef contains wiki code which uses the symbol '%%' to refer to the corresponding element of an include statement.

The table statement (which must be used as a prerequisite for tablerow) cares for the basics of table generation. So, when you define a column definition, you only need to specify the code for the field contents itself. You can start with field attributes like "bgcolor" or skip them. You can add a leading "\n" to make sure that the field contents is displayed correctly if it contains wiki syntax that depends on linebreaks (e.g. enumeration list). You must specify all columns. i.e. you must have as many entries in the tablerow statement as there are columns in your table. Skipping a column would suppress output for that column completely.

The tablerow command is best explained by an example (you can also find this example on the title page of this wiki):

<dpl>
  category=African Union member states
  nottitlematch=Sudan
  addpagecounter=true
  includepage ={Infobox Country or territory}:area:population_estimate,%0[100]
  format      =,,\n|align=right|²{#ifexpr:%COUNT%>300¦<big>'''%COUNT%'''</big>¦%COUNT%}²,
  table       =,Country,Area,Population,Text,#hits
  tablerow    =align=right|%%,align=right|%%,bgcolor=lightyellow|<small>%%</small>,\n|align=right|%%
</dpl>
  • We select some African countries, we exclude Sudan
  • We acquire a piece of meta data about the articles we will find (in our case the usage counter)
  • We include two named parameters from a template call, {{Infobox Country or territory}}
  • We include a short text passage from the text before the first chapter
  • We use the third parameter of format to output the usage counter (we could even highlight values above 100 here, for example)
  • We highlight usage values above 300
  • We define a standard wiki table with the article name in the first column (named "Country")
  • We define column headers for transcluded contents and for the usage counter
  • We care for right alignment of the numerical values and define a bgcolor for the text

tablesortcol

Template:DPL parameter

Syntax:

tablesortcol= number

number is the position of the column that shall be used as sortkey when the result is initially displayed.

  • column numbering starts with 1;
  • tablesortcol = 0 means do not sort; this is the default.
  • Negative numbers are used to sort in descending order; e.g. -3 would sort according to the third column in descending order.
  • Note that the rest of the row after the selected column will also be part of the sortkey; so the contents of successive columns may serve as a secondary sort criterion if there are identical values in the selected column.
  • Also note that the whole column contents is taken; this may include hidden contents or markup sequences if you used column formatting commands. For the same reason you cannot expect numeric contents to be sorted 'numerically' - sorting will always be alphabetical.
  • you can of course use something like 'class=sortable' together with 'tablesortcol'. The difference is that ..
    • interactive sorting only works after the article has been initially displayed
    • interactive sorting tries to guess the content type of a column and sorts according to that (date, number, string)
  • If you do not use tablesortcol the output order of your table rows will depend on the sort order by which the articles were analysed. That order depends on other DPL commands like ordermethod. The default is "alphabetically by title". So, without 'tablesortcol' you get the tablerows in alphabetical sequence of the article names where they come from. With 'tablesortcol' you can order them by the column contents itself.

Heading mode

headingmode

Template:DPL parameter

Syntax:

headingmode=modename

modename can be one of:

  • none — headings are not displayed, no heading — (default)
  • unordered — outputs an unordered list — HTML tag "ul"
  • ordered — outputs an ordered list — HTML tag "ol"
  • definition — outputs a definition list — HTML tag "dl"
  • H2 — outputs sections — HTML tags "H2"
  • H3 — outputs sections — HTML tags "H3"
  • H4 — outputs sections — HTML tags "H4"

Example:

<DPL>
  category=Africa|Europe
  ordermethod=category,title
  headingmode=definition
  mode=ordered
</DPL>

This list will output pages that belong to one of the categories Africa, Europe in a list similar to this (HTML source), with pages 1 and 2 in the Africa category, Page 1 in the Europe category as well (in fact, the titles are replaced with the appropriate links):

<dl>
  <dt>Africa</dt>
  <dd>
    <ol>
      <li>Page1</li>
      <li>Page2</li>
    </ol>
  </dd>
  <dt>Europe</dt>
  <dd>
    <ol>
      <li>Page1</li>
    </ol>
  </dd>
</dl>

Headingmode can be used with multi-column output but the length of the columns may in this case vary more than you would expect.

headingcount

Template:DPL parameter

Syntax:

headingcount=true

default is headingcount=false


listattr

Template:DPL parameter

Syntax: listattr= attribute1="val1" attribute2="val2" ...

Examples:

Input (HTML) Output Actual Output
<DPL>
ordermethod=category,title
headingmode=ordered
mode=none
listattr= class="submenul"
itemattr= class="submenuli" style="font-style: italic;"
</DPL>
<ol>
  <li> Cat1 (link)
    <div class="submenul">
      <span class="submenuli" style="font-style: italic;"> Page1_1 </span> <br/>
      <span class="submenuli" style="font-style: italic;"> Page1_2 </span>
    </div>
  </li>
  <li> Cat2 (link)
    <div class="submenul">
      <span class="submenuli" style="font-style: italic;"> Page2_1 </span> <br/> 
      <span class="submenuli" style="font-style: italic;"> Page2_2 </span>
    </div>
  </li>
</ol>
  1. Cat1 (link)
  2. Cat2 (link)
<DPL>
ordermethod=category,title
headingmode=ordered
mode=unordered
listattr= class="submenul"
itemattr= class="submenuli" style="font-weight: bold;"
</DPL>
<ol>
  <li> Cat1 (link)
    <ul class="submenul">
      <li class="submenuli" style="font-weight: bold;"> Page1_1 </li> 
      <li class="submenuli" style="font-weight: bold;"> Page1_2 </li>
    </ul>
  </li>
  <li> Cat2 (link)
    <ul class="submenul">
      <li class="submenuli" style="font-weight: bold;"> Page2_1 </li> 
      <li class="submenuli" style="font-weight: bold;"> Page2_2 </li>
    </ul>
  </li>
</ol>
  1. Cat1 (link)
  2. Cat2 (link)

itemattr

Template:DPL parameter

Syntax: itemattr= attribute1="val1" attribute2="val2" ...

Example: see listitemattr.

hlistattr

Template:DPL parameter

Syntax: hlistattr= attribute1="val1" attribute2="val2" ...

Example:

Input (HTML) Output Actual Output
<DPL>
ordermethod=category,pagetouched
headingmode=H2
mode=ordered
hlistattr= class="topmenul" id="dmenu"
</DPL>
<div class="topmenul" id="dynamicmenu">
  <H2> Category 1 (link) </H2>
  <ol>
      <li>Page1_1</li>
      <li>Page1_2</li>
  </ol>
  <H2> Category 2 (link) </H2>
  <ol>
      <li>Page2_1</li>
  </ol>
</div>

Category 1 (link)

  1. Page1_1
  2. Page1_2

Category 2 (link)

  1. Page2_1

See also hitemattr.

hitemattr

Template:DPL parameter

Syntax: hitemattr= attribute1="val1" attribute2="val2" ...

Example:

Input (HTML) Output Actual Output
<DPL>
ordermethod=category,title
headingmode=unordered
mode=ordered
hlistattr= class="topmenul" id="dmenu"
hitemattr= class="topmenuli" style="color: red;"
</DPL>
<ul class="topmenul" id="dmenu">
  <li class="topmenuli" style="color: red;"> Category 1 (link)
    <ol>
      <li>Page1_1</li>
      <li>Page1_2</li>
    </ol>
  </li>
  <li class="topmenuli" style="color: red;"> Category 2 (link)
    <ol>
      <li>Page2_1</li>
    </ol>
  </li>
</ul>
  • Category 1 (link)
    1. Page1_1
    2. Page1_2
  • Category 2 (link)
    1. Page2_1

userdateformat

Template:DPL parameter

Syntax:

userdateformat=formatstring

The formatstring may contain letters like "y,Y,m,M,d,D,h,H,i,I,s" for year, month day. Other characters are printed as they are. See the documentation for php function date() for more details [1]. The "userdateformat" applies to all date/time fields, see the parameters: addeditdate,addpagetoucheddate,addfirstcategorydate

Example:

userdateformat=Y-m-d (D)

Default:

By default DPL uses "Y-m-d H:i:s" to display date and time. Note that MediaWiki stores all dates/times in UTC format. When displaying a time stamp DPL will translate it according to

  1. the timezone preference (difference to UTC/GMT) given by the user in his user settings
  2. if no preference is given and for all anonymous users the local time on the server will be used.

So you will either see a time based on your local time (browser based) or based on the timezone in which the wiki server is running.

The same kind of translation applies to dates you specify when selecting articles by revsion date/time.

Control the way article names are displayed

shownamespace

Template:DPL parameter

Syntax:

shownamespace=false

Example:

<DPL>
  category      = Africa
  namespace     = Talk
  shownamespace = false
</DPL>

This list will output all Talk pages in [[Category:Africa]], listed without the Talk: prepended to page names.

Note that in "mode=userformat" there is a different way to decide whether you want to output the title with or without namespace. In mode=userformat two built-in variables are provided which contain the page name including the namespace (%PAGE%) and the base title name (%TITLE%).


escapelinks

Template:DPL parameter

Syntax:

escapelinks=false

Note: You can use this parameter to show images; an other way to do this is to use the gallery extension in combination with DPL; there is an example for this on the dpldemo website.


titlemaxlength

Template:DPL parameter

Syntax:

titlemaxlength=number of characters

replaceintitle

Template:DPL parameter

Syntax:

replaceintitle=search for,replacement

The "search for" argument must be an expression which can be used in a php preg_replace() function call.

Example:

to remove the string "demo" in article names, you must write

replaceintitle=/demo/,

Note that standard regexp rules apply. The regexp must start with a non-alphanumeric character -- but not with a backslash! It is good habit to use a '/' if this character is not needed within the regexp itself. Read the php manual to understand the details of regular expressions.


Arranging article lists in columns and rows

columns

Template:DPL parameter

Syntax:

columns=ncols

Example:

<dpl>
  category=Test
  columns=3
  rowcolformat=width=100%
</dpl>

Simply displays all articles and subcategories in Category:Test in 3 columns (rowcolformat is used to make the table width 100%).

More complex example:

In mode=userformat the outer tags from listseparators will be repeated for each column.

<DPL>
  category=Africa
  addpagesize=true
  ordermethod=size
  mode=userformat
  listseparators={|class=sortablewikitable id=2\n!Rank\n!Article\n!Bytes\n|-,\n|%NR%.\n|[[%PAGE%]]\n|align=right|%SIZE%,\n|-,\n|}
  count=12
  columns=3
</DPL>

The output will contain a list of the 12 largest articles on Africa, arranged in three columns. Each column consists of a table which has itself three columns: rank, article name and size. Unfortunately, it doesn't work...

Rank Article Bytes
1. Categoria:Nordafrica 103
2. Sahara Occidentale 2155
3. Lampedusa 3248
4. Sud 3971
5. Madagascar 4146
6. Phacochoerus africanus 4748
7. Repubblica Democratica del Congo 4929
8. Aye-aye 5868
9. Ciad 6083
10. Multinazionale 7588
11. Bambino soldato 7666
12. Darfur 7775

rows

Template:DPL parameter

Syntax:

rows=nrows

In "mode=userformat" the outer tags from "listseparators" will be repeated for each column. Thus you can create long lists where the table heading is repeated from time to time.

Example:

<DPL>
  category=Africa
  addpagesize=true
  ordermethod=size
  mode=userformat
  listseparators={|class=sortablewikitable id=2\n!Rank\n!Article\n!Bytes\n|-,\n|%NR%.\n|[[%PAGE%]]\n|align=right|%SIZE%,\n|-,\n|}
  count=12
  rows=2
</DPL>

The output will contain a list of the 12 largest articles on Africa, arranged in two rows (of 6 lines each). Each row consists of a table which has itself three columns: rank, article name and size.

rowsize

Template:DPL parameter

Syntax:

rowsize=nrowsize

In "mode=userformat" the outer tags from "listseparators" will be repeated after each group of "rowsize" output lines. Thus you can create long lists where the table heading is repeated in regular intervals.

Example:

<DPL>
  category=Africa
  addpagesize=true
  ordermethod=size
  mode=userformat
  listseparators={|class=sortablewikitable id=2\n!Rank\n!width=200px|Article\n!Bytes\n|-,\n|%NR%.\n|[[%PAGE%]]\n|align=right|%SIZE%,\n|-,\n|}
  rowsize=20
</DPL>

The output will contain a list of all articles on Africa. After each group of 20 entries (article names) the table heading will be repeated. It may be useful to set the width of the column with the article names explicitly, so that the tables in each row have equal width.

rowcolformat

Template:DPL parameter

Syntax:

rowcolformat=html tags

Example:

<DPL>
  category=Africa
  columns=3
  rowcolformat=cellspacing=20
</DPL>

There will be more space around the columns than normal. See columns above for another example.

The ideal way to use rowcolformat is to assign a CSS class to your DPL table which has been defined in your mediawiki:Common.css article.

Example:

<DPL>
  category=Africa
  columns=3
  rowcolformat=class=dpl3columns
</DPL>

In your Common.css article you might have written something like

table.dpl3columns td {
  background: #f2f2f2;
  padding: 0.5em;
  border:3px;
  width:33%;
}