Jump to content

Controlling output volume

From DynamicPageList3 Manual
Manual Parameters Controlling output volume


By default, DynamicPageList3 shows the name of each article, including its namespace in the result set as a link to the article. By setting the volume control parameters of DPL3, it is possible to:

  • Specify a header/footer to show when results are found or not found.
  • Add metadata (size, author, last edited by, date of last change, etc.) to the output.
  • Include contents from articles.
  • Show the number of articles in the result set.
  • Cut off the articles' content at a certain length.
  • Add access date (frequency, date of last access).
  • Add the articles' contents or parts of it.


[edit source]

resultsheader

[edit source]
resultsheader Output a headline, before DPL3 results, if there is at least one article to display.


Syntax:

resultsheader=some wiki text


Example:

This lists pages in category Dessert examples and uses mode=userformat for complete control over the output. As listseparators or format are not set, nothing is displayed except the resultsheader content specified. The %PAGES% variable fetches and displays the number of results found for the query, despite none being listed.

Code
{{#dpl:
|category      = Dessert examples
|mode          = userformat
|resultsheader = <i>There are %PAGES% pages on desserts.</i>
}}
Result

There are 3 pages on desserts.


Notes:

  • %PAGES% - Outputs the number of articles in the result set. If the query result is limited (by system settings or by the count parameter) %PAGES% only shows the upper limit.
  • %TOTALPAGES% - Outputs the number of articles in the result set, regardless of count limits, which may consume extra resources; it is only calculated if used.
  • %VERSION% - Displays the current DPL3 version (see also Special:Version).
  • The symbol or \n is converted to a newline symbol. This is useful if you want to use wiki markup that needs to start at the beginning of a line (if the wiki parser requires a linefeed to understand your wikitext).
  • If oneresultheader is specified as well, the latter is used in case there is exactly one entry in the DPL3 result set. resultsheader is only used if there are two or more entries in the result set.


resultsfooter

[edit source]
resultsfooter Output a 'footline', after DPL3 results, if there is at least one article to display.


Syntax:

resultsfooter=some wiki text


Example:

This lists pages in category Dessert examples in the default unordered list (bullet) formatting. The resultsfooter value sets the text for a message about the number of existing articles, using the %PAGES% variable to display the total number selected in the footer.

Code
{{#dpl:
|category      = Dessert examples
|resultsfooter = \nThere are %PAGES% pages on dessert.\n
}}
Result

There are 3 pages on dessert.


Notes:

  • %PAGES% - Outputs the number of articles in the result set. If the query result is limited (by system settings or by the count parameter) %PAGES% only shows the upper limit.
  • %TOTALPAGES% - Outputs the number of articles in the result set, regardless of count limits, which may consume extra resources; it is only calculated if used.
  • %VERSION% - Displays the current DPL3 version (see also Special:Version).
  • The symbol or \n is converted to a newline symbol. This is useful if you want to use wiki markup that needs to start at the beginning of a line (if the wiki parser requires a linefeed to understand your wikitext).
  • If oneresultfooter is specified as well, the latter is used in case there is exactly one entry in the DPL3 result set. resultsfooter is only used if there are two or more entries in the result set.


oneresultheader

[edit source]
oneresultheader Output a headline, before DPL3 results, if there is exactly one article to display.

Syntax:

oneresultheader=some wiki text


Notes:

  • The symbol or \n is converted to a newline symbol. You may need this if the wiki parser requires a linefeed to understand your wikitext.
  • %VERSION% is replaced by the current DPL3 version. This is useful if you want to use wiki markup, which needs to start at the beginning of a line.


oneresultfooter

[edit source]
oneresultfooter Output a 'footline', after DPL3 results, if there is exactly one article to display.


Syntax:

oneresultfooter=some wiki text


Notes:

  • The symbol or \n is converted to a newline symbol. You may need this if the wiki parser requires a linefeed to understand your wikitext.
  • %VERSION% is replaced by the current DPL3 version. This is useful if you want to use wiki markup, which needs to start at the beginning of a line.


noresultsheader

[edit source]
noresultsheader Output a headline if there is no article to display (empty result).


Syntax:

noresultsheader=some wiki text


Example:

The first example lists pages from a nonexistent category, to cause the noresultsheader output to display (for example purposes), the second uses a non-breaking space &nbsp; to output no result, and the third uses \n to display output no result.

Code
A)
{{#dpl:
|category        = notArealCategory
|noresultsheader = <i>No results found</i>
}}

B)
{{#dpl:
|category        = notArealCategory
|noresultsheader = &nbsp;
}}

C)
{{#dpl:
|category        = notArealCategory
|noresultsheader = \n
}}
Result

A) No results found

B)  

C)


Notes:

  • Setting a single blank or newline character (noresultsheader=&nbsp; or noresultsheader=\n) suppresses the warning message from DPL3 that is normally issued if no articles are found.
  • The symbol or \n is converted to a newline symbol. You may need this if the wiki parser requires a linefeed to understand your wikitext.


suppresserrors (DEPRECATED)

[edit source]

This parameter is deprecated and is left in the code as a null parameter to give people time to remove it from their queries. It will be fully removed in a future release of DPL3.

suppresserrors Suppress the warning message if no matching article was found.


Syntax:

suppresserrors=true


Notes:

  • Setting suppresserrors to true has the same effect as setting noresultsheader to a single space character. The command is provided for downward compatibility reasons with older DPL versions.
  • See also: debug.


noresultsfooter

[edit source]
noresultsfooter Output a footline if there is no article to display (empty result).


Syntax:

noresultsfooter=some wiki text


Note: noresultsfooter is essentially the same as noresultsheader. If there is no output to display, the difference between header and footer becomes incredibly marginal.


Adding metadata to the output

[edit source]

addcategories

[edit source]
addcategories Shows all categories to which an article belongs as a small text line after the article name.


Syntax:

addcategories = true


Example:

This selects pages whose titlematch begins with "Appl" OR "Oran", and the addcategories parameter includes a list of categories they belong to after each entry.

Code
{{#dpl:
|titlematch    = Appl%¦Oran%
|addcategories = true
}}
Result


Notes:


addpagecounter

[edit source]
addpagecounter Shows number of times the page has been viewed.
Requires Extension:HitCounters to be used. This extension is not yet available on Miraheze.


Example:

{{#dpl:
|category       = Dessert examples
|ordermethod    = counter
|order          = descending
|addpagecounter = true
|count          = 3
}}

This would show the 3 most popular articles about dessert.


Note: in mode=userformat the access counter can also be referenced as a built-in variable.


addpagesize

[edit source]
addpagesize Shows the size of the page.


Example:

This lists pages in category Dessert examples, sets addpagesize to true to include page size after the page name, ordermethod=size sets sort order by page size, and order set to descending reverses the usual order. Results are limited to a count of 1, so only the largest page in the category appears.

Code
{{#dpl:
|category    = Dessert examples
|addpagesize = true
|ordermethod = size
|order       = descending
|count       = 1
}}
Result


Note: in mode=userformat the size can also be referenced as a built-in variable.


addcontribution

[edit source]
addcontribution Shows how much a user contributed to an article.


Syntax:

addcontribution=true — (Default is false)


Using this parameter restricts the output to articles that were edited recently (this is usually one week or one month, according to the setup of the wiki).

A link to the contributor is provided and an "asterisk bar" appears indicating how many bytes in the article were changed by that user.

You will also have the built-in variables %CONTRIBUTOR%, %CONTRIB% and %CONTRIBUTION% available to be used in your own format statement.


adduser

[edit source]
adduser Requires ordermethod=[...,]firstedit or ordermethod=[...,]lastedit (where the [...,] signifies a complex ordermethod with extra parameters). If firstedit (or lastedit), adduser=true displays the user who made the first (or last) revision of the page. In this way, the parameter is equivalent to the addauthor (addlasteditor) parameter (see below).


Syntax:

adduser=true — (Default is false)


Example:

This lists pages in category Fruit examples, uses adduser with the value true to append the author, and sets ordermethod to lastedit to sort by the last revision. Results are limited to a count of 3.

Code
{{#dpl:
|category    = Fruit examples
|adduser     = true
|ordermethod = lastedit
|count       = 3
}}
Result


Note: If mode=userformat the user can be referenced using the built-in variable %USER%.


addauthor

[edit source]
addauthor Show the user who created the article, cannot be used with addlasteditor


Syntax:

addauthor=true — (Default is false)


Example:

This lists pages in category Fruit examples, and uses addauthor with a value of true which shows the user who edited the initial revision. Result are limited to a count 3.

Code
{{#dpl:
|category  = Fruit examples
|addauthor = true
|count     = 3
}}
Result
  • Apple . . [[User:imported>FrozenPlum|imported>FrozenPlum]]
  • Grape . . [[User:imported>FrozenPlum|imported>FrozenPlum]]
  • Orange . . [[User:imported>FrozenPlum|imported>FrozenPlum]]


addlasteditor

[edit source]
addlasteditor Show the user who edited the most recent revision of a page, cannot be used with addauthor


Syntax:

addlasteditor=true — (Default is false)


Example:

This lists pages in category Fruit examples, using addlasteditor to add the last user who edited the page, with results limited to a count of 3.

Code
{{#dpl:
|category      = Fruit examples
|addlasteditor = true
|count         = 3
}}
Result


Note: The same behavior can be achieved (and formatted) using:

  • addlasteditor = true and
  • |format = ,\n* [[%PAGE%|%TITLE%]] . . [[User:%USER%|%USER%]]


addpagetoucheddate

[edit source]
addpagetoucheddate Shows date/time of last change to the page according to the definition of the 'page_touched' field on Page_table.

Requires ordermethod=[...,]pagetouched or ordermethod=[...,]title ([...,] means complex ordermethods with an extra parameter before are allowed.)


Syntax:

addpagetoucheddate=true — (Default is false)


Example:

This lists pages in category Dessert examples, with ordermethod set to sort by pagetouched. Adding addpagetoucheddate prepends each result with the date of last change. Results are limited to a count of 3.

Code
{{#dpl:
|category           = Dessert examples
|ordermethod        = pagetouched
|addpagetoucheddate = true
|count              = 3
}}
Result


Notes:

  • In mode=userformat this date can also be referenced as a built-in variable %DATE%.
  • The formatting of the date can be influenced using userdateformat.
  • The date is translated to your local time zone (if defined in your preferences) or to the server's time zone.


addeditdate

[edit source]
addeditdate If firstedit (resp. lastedit), addeditdate=true shows the date of the first revision/creation (resp. last revision) of the page. Requires ordermethod=[...,]firstedit or ordermethod=[...,]lastedit ([...,] means complex ordermethods with an extra parameter before firstedit/lastedit are allowed.)

Conflicts with other "add*date" (addpagetoucheddate, etc.) parameters.


Syntax:

addeditdate=true — (Default is false)


Example:

This lists pages in category Fruit examples, with ordermethod set to lastedit which sorts by last edit date, and using addeditdate=true to prepend each result with the date of last revision. Results are limited to a count of 3.

Code
{{#dpl:
|category    = Fruit examples
|ordermethod = lastedit
|addeditdate = true
|count       = 3
}}
Result


Notes:

  • In mode=userformat this date can also be referenced as a built-in variable %DATE%.
  • The formatting of the date can be influenced using userdateformat.
  • The date is translated to your local time zone (if defined in your preferences) or to the server's time zone.


[edit source]
addexternallink Add the URL of an external link to the output list.

Syntax:

addexternallink=true — (Default is false)


Note: The command makes only sense in combination with linkstoexternal.


addfirstcategorydate

[edit source]
addfirstcategorydate Shows the date/time the article was added to one of the listed include categories. If more than one category is listed and an article belongs to more than one of them, the result is ambiguous.

From a logical standpoint, it is recommended to include one category only with the category parameter, or to make sure that each of the articles in the result set belongs to only one of the categories listed. Conflicts with other "add*date" (addeditdate, etc.) parameters.


Syntax:

addfirstcategorydate=true — (Default is false)


Example:

This lists pages in category Fruit examples, addfirstcategorydate = true prepends each result with the time and date (formatted according to your local mediawiki date display preferences or the user preferences if user logged in). The result count is limited to 3.

Code
{{#dpl:
|category             = Fruit examples
|addfirstcategorydate = true
|count                = 3
}}
Result


Notes:

  • In mode=userformat this date can also be referenced as a built-in variable %DATE%.
  • The formatting of the date can be influenced using userdateformat.
  • The date is translated to your local time zone (if defined in your preferences) or to the server's time zone.


showcurid

[edit source]
showcurid Page links will contain the current page ID, cannot be used together with openreferences=true.


Syntax:

showcurid=true — (Default is false)


Example:

This lists pages in category Dessert examples; the hyperlinks to these pages look normal (displaying page name), but setting showcurid to true adds the use of an additional MediaWiki parameter named curid, which displays the page's numeric ID at the end of the URL.

Code
{{#dpl:
|category  = Dessert examples
|showcurid = true
}}
Result


Notes:

  • showcurid=true cannot be used together with openreferences=true.
  • Using this type of link may be somewhat faster than using the title only. This kind of link is useful for some web spiders (e.g., some search engine spiders may need a unique ID within the pagelink) and it works even if the title has moved.


Alternate Example:

This syntax can be accomplished manually with similar functionality to showcurid where format is used, the \n* creates a new line with a bullet, then the MediaWiki magic word {{fullurl:}} creates the URL from the %PAGE% variable, and feeds the URL the %PAGEID% URL parameter as an external link.

Using a magic word (or parser function) in the {{#dpl:}} method of using DPL3 requires special syntax, the nested double curly {{ braces }} must be replaced with ²{ and respectively, and pipe | characters must be replaced with ¦ or {{!}}. The <span class="plainlinks"></span> wraps each link with an existing CSS class to prevent the external link icon from displaying.


Code
{{#dpl:
|category = Dessert examples
|format   = ,\n* <span class="plainlinks">[²{fullurl:%PAGE%¦curid=%PAGEID%}² %PAGE%]</span>
}}
Result



Include contents from the articles in the result set

[edit source]

include

[edit source]
include Include pages (whole content) or include certain sections of articles or template parameters.

This functionality is based on the ideas and work of Steve Sanbeg and his extension Labeled Section Transclusion. DPL3 comes with a modified version of Sanbeg's source, so there is no need for additional installation.

With include you can incorporate one or more of the following

  • The whole article as it is
  • A certain chapter -- identified by its headline
  • A certain chapter -- identified by its position (sequence number, regardless of level)
  • Parameter(s) used in template calls
  • The output of a surrogate template (phantom template) which is used instead of the original template
  • Pieces of text which are marked by special section markers

There is a close correlation between the output of the include statement and table and tablerow. You should understand those statements if you want to create tabular output from included content.

The syntax for this parameter is outlined in multiple sections below.


include whole article

[edit source]

Syntax:

include = * — The character * functions as a wildcard.


Example:

This lists selects pages whose titlematch is Apricot (selecting just that page). The include = * statement includes the page's entire contents, and the format line wraps the result in a table with an orange border. Using eliminate supresses the inclusion of categorizations in the result, removing them from the output.

Code
{{#dpl:
|titlematch = Apricot
|include    = *
|format = ¶{¦ style="border:1px solid orange; width:100%;",¶¦,,¶¦}
|eliminate  = categories
}}
Result


Fruit examples
Fruit Type
Controlling output volume

Growth Location
On trees

This is an Apricot, it is orange.


Note: you can use includemaxlength = n (where n is an integer) to restrict the included text to a portion of the article. The text is truncated in a way which does not spoil tag structures or nested brackets. A result is cut at a word boundary if possible.


include page sections (chapters)

[edit source]

Syntax:

include = #heading1,#heading2,... — The character # is used as a prefix to the page section heading (chapter) name.


Specifying #heading1 includes text from 'heading1' (case-insensitive) until the next heading of the same or lower level.

  • Instead of the prefix #, @ can be used (the # may lead to problems in certain cases); @@ acts as a regexp comparison just as ## does.
  • Normally a text pattern is compared literally and it must match the whole headline of the chapter. If a double hash ## is used, however, the text is taken as a (case-insensitive) regular expression. It is automatically enclosed within slashes, and will refer to the headline as a whole (^regexp$). So, if only matching part of the text is desired, .* must be added around the pattern. Correct regexp syntax must be provided; otherwise, runtime errors may be seen, no output received etc.
{{DPL|include}} = ##.*omethin.* — This matches a page section name like "This is something old" or "That Was Something Old".
Formerly, this example stated that if more than one section exists with the same name, only the first is displayed, similar to how Labeled Selection Transclusion functions); however, this currently includes all sections with the same name, and may appear differently in different result formats.


Example:

This lists pages whose titlematch is Grape (only that page), and uses include to includes the content of the page section (indicated by #) named "about" OR "About" (since include is not case-sensitive). The table statement styles the result as a simple table, and specifies column headers. When using table format, if more than one section has the same name, each section is listed in a separate row. If the table statement is removed, the title appears only once, followed by each section's contents, one after the other.

Code
{{#dpl:
|titlematch = Grape
|include    = #about
|table      = class="wikitable sortable", Page, Section content
}}
Result
Page Section content
Grape

A grape is a fruit type, it grows in clusters or bunches.

Grape

Some grapes appear to be yellow, orange, green, and pink, though others can be dark red, near black, or even deep blue.


Notes:

  • This functionality is also available as a separate parser function (called #dplchapter).
  • If there is no chapter with the specified heading, the output will be empty.
  • You can also limit the amount of text for each section displayed in the output, which automatically generates a link to view the rest of the content:
{{DPL|include}} = #heading1,#heading2[''n'' ''linktext''],..., where n is the number of characters to include, and linktext is the characters or text used as the link label.
  • If the remaining text is longer than the limit, it is cut and a link appears pointing directly to the chapter which was included.
  • When truncating included text portions, care is taken not to break words midway through, and not to spoil wiki syntax (i.e., maintain a symmetry of brackets and braces, make sure that nowiki and pre tags are balanced). Therefore, the size of the included text can deviate from what was specified.
  • Note that %SECTION% can be used in secseparators to fetch the section name, which may be useful to customize the text to include the (otherwise unseen) section name:
{{DPL|secseparators}}<nowiki> = ,[[%PAGE%#%SECTION%|more "%SECTION%"...]]
  • This variable is replaced by "article#heading" if used in secseparators. It is up to you to create a link from this text using normal wiki syntax if you wish.
Note: Content related to or involving filters may be non-working or incorrect; as such, this section may be removed at a later date.
  • Add one or more optional filter expressions, a character limit and/or an optional link text in square brackets to shape the included portion of text : [filter 1~...~filter n~limit text].
    • The filters are applied before calculating the length of the text; they simply throw away the matching part of the contents.
    • If the remaining text is longer than the limit, it is cut and a link appears which points directly to the chapter which was included. Using "1" as a limit only shows the link (if the corresponding chapter in the article is not empty), "0" does not show anything, not even the link. When truncating included text portions care is taken not to spoil wiki syntax (i.e., maintain a symmetry of brackets and braces, make sure that nowiki and pre tags are balanced). Therefore, the size of the included text can deviate from what you specified.


include sections by on-page position reference

[edit source]

To include sections according to their position on the page, use a simple number with a % as prefix. %0 includes the text BEFORE the first chapter, %1 includes the first chapter, %6 the sixth and so on. Chapters are counted regardless of their level. No nesting logic is applied. %-1 is a special value which refers to the last chapter of an article (%-2 does not work, however). %2[30] includes the first thirty characters of the second chapter. %SECTION% contains the heading of the selected chapter.


Example:

This selects pages in category Fruit examples, and uses include to include the first 30 characters of the first and third page sections (if present), based only on their position on source pages. The result count is limited to 5.

Code
{{#dpl:
|category = Fruit examples
|include  = %1[30],%3[30]
|count    = 5
}}
Result


[edit source]


Syntax:

include={my template} — The character # is used as a prefix to the page section heading name.

The the result of a template call can be included by specifying the template name within curly braces. So, include={my template} displays the result of the template call with the original parameters used on the selected article page.


Notes:

  • A space char or a line break must be specified after this statement before ending the #dpl parser function call or the MW parser may be fooled by three successive closing curly braces.
  • MediaWiki treats spaces like underscores. Therefore, {my template} also matches a template invocation like {{My_template|...}}.
  • MediaWiki searches for template calls in the template namespace. Specifying {my template} also matches a template invocation like {{Template:My_template|...}}.
  • Using a different namespace also works: {Xyz:my template} matches a template invocation in namespace Xyz. {:my template} matches a template invocation in the main namespace like {{:my template|...}}.
  • Include one or more template parameter values by specifying a list of parapeter names (or position numbers) separated by colons : (and optional white space). Names are used for named parameters, numbers for positional (anonymous) parameters.
The following would include the values of the 'age' and 'size' paraneter, and the first unnamed parameter of the template "animal":
{{tt|include}} = {animal}:age:size:1
  • It is even possible to use expressions which contain a % symbol as pseudo parameters:
{{tt|include}} = {animal}:age:%PAGE%:size:1


Example:

This lists pages in category Fruit examples and uses include to include from the Fruit-Infobox template, the variable for page title (%TITLE%), and the "image" and "grows" parameter values. In the table statement, the first argument adds CSS classes to the table, the second "-" deliberately omits the (automatic) linked page name from the first column, and the rest specify column headings.

The tablerow parameter essentially allows the values it holds to be precisely positioned within any formatting applied; the %TITLE% (first) value of the include is carried down to the first column by specifying %% in first position of the tablerow statement. The title is then wrapped in a <span></span> with formatting to make it italic. The next argument carried down is the "image" value (using %%) adding content before and after to format it as a rendered image at 30 pixels wide. The last tablerow argument %% displays the results of the "grows" parameter, this time without added formatting.

Important notes:

  • The include and tablerow parameters work together as a pair (table also).
  • The tablerow parameter essentially allows values to be precisely positioned within any basic formatting it applies.
  • Using %% caries down each value from the include statement, to the same position in the tablerow statement, though this is affected by the automatic creation of a first column containing linked page name (which we've used - in second position of the table statement to suppress).


Code
{{#dpl:
|category = Fruit examples
|include  = {Fruit-Infobox}:%TITLE%:image:grows
|table    = class="wikitable sortable",-,Page Name, Image, Grows
|tablerow = <span style="font-style: italic;">%%</span>,[[File:%%|30px]],%% 
|count    = 5
}}
Result
Page Name Image Grows
Apple On trees
Grape On vines
Orange On trees
Plum
Banana On a tree-like plant


Surrogate tempates

Instead of listing parameter values, the output of one or more 'surrogate' templates can be included (also called 'phantom templates'). DPL3 calls the template(s) instead of the original, and allows the identical parameter list to be worked with (plus additional DPL3 parameters). The output of the surrogate template sets (and formats) one line of results, which is then applied to each subsequent result in the result set. To make this happen, the name of a template must be specified within single curly braces and a suffix added. Five additional DPL3 parameters are also passed to the template, and can be used within it:

  • %PAGE% – Outputs the name of the article (including namespace), corresponds to the Magic Word {{FULLPAGENAME}}.
  • %TITLE% – Outputs the title of the article (without the namespace), corresponds to the Magic Word {{PAGENAME}}.
  • %DATE% – Outputs the date selected, e.g., ordermethod=lastedit; requires addeditdate=true or similar; the formatting of the date can be influenced using userdateformat=.
  • %USER% – Outputs the user who changed the article last; requires adduser=true or addlasteditor=true.
  • %CATLIST% – Outputs a pipe-separated list of links to all categories to which the article belongs (requires addcategories=true).


Example:

This lists pages in category Fruit examples and includes the contents of the {{Fruit-Infobox.templatevalues}} surrogate formatting template. The table parameter sets the tale styles and headers, and since it does not include a - in second place to suppress the automatically linked page titles in first place, it formats only the second and third columns of results.

If - was in second position for table, the first column would drop off and the page name would need to be added to table statement or surrogate template, its value could be called or used like a normal parameter {{{%PAGE%}}} using it variable name.

Code
{{#dpl:
|category = Fruit examples
|include  = {Fruit-Infobox}.templatevalues
|table    = class="wikitable sortable",Page,Grows,Image
|count    = 2
}}
Result
Page Grows Image
Apple On trees
Grape On vines


Example:

This selects pages with the title Apple (only that page), which uses the {{Color}} template on its page more than once. The include statement both includes all parameters available, and it passes their values to the specified surrogate {{Color.templatevalues}} formatting template. As the title parameter implicitly sets mode=userformat, which allows additional control over output usng the secseparators statement (an alias for format).

format=Startall,Start,End,Endall where Startall, Start, End and Endall are wiki tags used to separate the list items:
  • Startall before all — e.g., may specify wikitext to begin a table (including headers).
  • Start before each — e.g., may specify wikitext to begin row, its cell and cell content.
  • End after each — e.g., may specify content to end a cell or row.
  • Endall after all — e.g., may specify content to end a table.
Note: |debug = 5 can be added to view any resultant wikitext given, and should always be put at the top of the statement, a value of 0 disables it.


The first argument of secseparators sets nothing , is displayed before all, then its second argument sets a line break \n and four hyphens ---- (which create a horizontal rule/line) before each result. Another line break \n puts each result below the next. If the secseparators line is removed, results appears side by side instead.

Code
{{#dpl:
|title         = Apple
|include       = {Color}.templatevalues
|secseparators = ,\n----\n
}}
Result

red


green



Notes:

  • There is an alternate syntax to specify a surrogate template that has the advantage that the surrogate template may reside in a different namespace than the original template. Furthermore, the surrogate template's name can be wholly different from the original template name: {template¦surrogate template}. For example, you may specify something like {my template¦Help:Substitution for my template}.
Formerly it was stated that, if a page listed in the result does not use the specified template, the DPL3 engine calls a template with the additional suffix ".default", with %PAGE% and %TITLE% as parameters; this is not currently true, ".default" does not appear, the result just won't display.


include parser function calls

[edit source]

If a pattern like {#pfunc}.list is specified, DPL3 looks for calls of the parser function 'pfunc'. DPL3 passes the parameters of this parser function to a template, which must be provided under the name of 'Template:pfunc.list'. Instead of '.list' a desired suffix can be specified. The Template receives the parser function name as %PFUNC% and all parameters under their normal name or number. Instead of specifying a single parser function, a generic pattern can also be used.


Example:

This selects pages with the title Examples (one page), and uses include to include all DPL3 parser function calls {{#dpl:}} used, and the parameter values of each. The {{Dpl.examples}} surrogate template specified ends in the chosen ".examples" suffix, resulting in: Template:dpl.examples; that surrogate only makes use of the {{{category|}}} and {{{ordermethod|}}} parameters, to pass those parameter's values to the output.

The table statement's first argument (left empty) defaults to class="wikitable"), and the second and third arguments set the column headers. Since {{#dpl:}} was used more than once on the Examples page, one line of output for each instance appears (and table separates these per line with a repeating title, where other formats may list the title once and all values thereafter).

Code
{{#dpl:
|title   = Examples
|include = {#dpl}.examples
|table   = ,Page,<code>category</code> parameter value, <code>ordermethod</code> parameter value
}}
Result
Page category parameter value ordermethod parameter value
Examples Criteria for page selection (examples) title
Examples Controlling output format (examples) title
Examples Controlling output order (examples) title
Examples Examples by module use title
Examples Examples by parameter use title
Examples Miscellaneous examples
Examples Criteria for page selection (examples)
Examples Demo output pages
Examples Example templates
Examples Surrogate (phantom) templates


Note: This function is not very robust. It cannot handle nested parser functions properly.

To find all parser functions, {#.+} can be used:

{{DPL|include}}={#.+}.''pfunc''
  • The .+' portion is treated like a regular expression.
  • The search itself is based on simple heuristics, so the output may not always be correct.


include parser extension (tag) calls

[edit source]

If a patter like {~func}.list is specified, DPL3 looks for calls of the parser extension (tag) with the tag name <func>. DPL3 passes the body (all contents) of the tag (as-is, including line breaks) to a template, which must be provided under the name of 'Template:func.list'. Instead of '.list' another desired suffix can be used. The Template receives the parser extension (tag) function name as %TAG% and the body contentis named %TAGBODY%. Note that this function is not very robust, it cannot handle nested tags properly.


include specially labeled text portions

[edit source]

To include sections which are labeled with special tags, you just mention the tag name. Refer to Labeled Section Transclusion for details on how to label sections in your pages accordingly:

include=sec1,sec2,...

If the section name starts with * (asterisk), the asterisk is cut off and the rest of the text is taken as a regular expression. If the section name is ** it matches all section names. In both cases, the tag name precedes the output, separated by ::.

Example:

This lists pages whose title is Apple Pie (just that page), and uses include to include the content of its <section begin="one" /><section end="one" /> tags (seen using source edit), as well including the values for section tags "two" and "three". The secseparators statement uses a nested template {{sp}} to create a non-breaking space, followed by two dashes, and another space. As nested templates must use a special syntax, the {{sp}} template is called using ²{sp}².

Code
{{#dpl:
|title         = Apple Pie
|include       = one,two,three
|secseparators = ²{sp}²--²{sp}²
}}
Result

 -- one slice -- two slices -- three slices


includematch

[edit source]

See includematch for regexp content selection, using Perl regular expressions.


include nothing

[edit source]

To include nothing from the page (no inclusion), leave blank (this is default):

include=
  • A single - sign has the same effect; such a dummy parameter can be useful if you want to put content into columns of the output table which is not derived from the include statement


Combinations of the above possibilities

[edit source]

All of the above can be combined, you can even refer to the same template or heading more than once.

include = {template1}suffix1,{template1}:p1:p2:2,#headline,marker,...


Example:
include = foo,#bar[200 ..more..],{boo}.dpl

This would include:

  • A text portion named "foo" which is marked by special tags.
  • The contents of a page section named "bar"; only the first 200 characters of wiki text are shown; if the chapter is larger than that, a link with the text "..more.." points to the source.
  • The output of template "boo.dpl" being called with the same parameters that were used to call template "boo" in the original page.
  • See also includematch.


includepage

[edit source]
includepage This can be used as a longer name for include.


includemaxlength

[edit source]
includemaxlength Delimit the size of an included article to a maximum of n number of characters. Only used with includepage=*.


Syntax:

includemaxlength=n - where n is an integer.

Example:

This lists pages whose title is Some Page (one page), and category is used to include * all page content. The includemaxlength is limited to 5 characters, after which the result is truncated.

Code
{{#dpl:
|title            = Some Page
|include          = *
|includemaxlength = 5
}}
Result

Examp ..→


includetrim

[edit source]
includetrim Removes all leading and trailing whitespace from transcluded contents.


Syntax:

includetrim=true (default is false)


Note: This parameter is only useful in combination with include.

Cookies help us deliver our services. By using our services, you agree to our use of cookies.