Anonymous user
General usage and invocation syntax: Difference between revisions
no edit summary
imported>FrozenPlum (Not sure why examples how to scroll etc were on a general use and syntax page, but make it only so this has general use and syntax (the rest moved where it belonged), and, there were 3 or for disparate places for scroll info, there's now just this syntax/reference, and the main source (has 2 identically named sections on selection critera page too)) |
imported>FrozenPlum No edit summary |
||
Line 2:
{{DPL manual|section=General usage and invocation syntax}}
{{tocright}}
'''DynamicPageList3 (DPL3)''' can be used as a '''parser extension''' (<small><code><nowiki><dpl> .... </dpl></nowiki></code></small>) or as a '''parser function''' (<small><code><nowiki>{{#dpl: .... }}</nowiki></code></small>). There is no general rule which one is better. If in doubt, you may want to use the '''parser function syntax''', as it '''is more powerful'''.
Line 12 ⟶ 14:
* [[Orange]]
==Syntax used in this manual==
Most examples in this manual typically use the parser function-based syntax <code><nowiki>{{#dpl:}}</nowiki></code> given it is the more flexible syntax. Examples are wrapped in <code><nowiki><pre></pre></nowiki></code> tags, so the plain wikitext used to create a result can be seen without rendering the result itself.
Most of the manual deals with the explanation of individual parameters. This is independent of the choice between the two variants described above. So, if you read something like
* parameter = value
you should have in mind that you must either place DPL3 tags around (using a separate line for each parameter) or use the parser function syntax and separate parameters by pipe characters.
==DPL3 Invocation syntax==
===Parser extension (tag) method===
The following example would probably be used directly on an article page, but could also be included as part of a template. Parser extensions define a specific tag (in this case <code><nowiki><dpl></nowiki></code>) and a corresponding end tag (<code><nowiki></dpl></nowiki></code>). '''The text between these tags is handed over to the extension module ''just as it is''.'''
Line 85 ⟶ 97:
==Special note on ''Self References''==
In principle a DPL3 query could be written in a way that the page containing the query (or the page including a template which contains the query) would be part of the result set. Experience in the past has shown that in some cases this leads to unwanted effects. For instance, the page containing the query from a MediaWiki point of view contains links to all pages it lists. If your DPL3 statement contains a "uses" clause, you will be astonished to find your own page in all results. The same happens with categories... In addition, there were technical problems with self referencing result sets (parser loop references, which seemed very hard to solve). So, it was decided to skip a self reference in the result set by default.
{{note|'''Important:''' DPL3 does not normally return its own page (a self link/reference) in the result set. To include a page that references itself in the result, you must use <code>{{DPL|skipthispage}}{{=}}''no''</code>|error}}
You can suppress back references to a page containing a DPL3 query by using <code>{{DPL|reset}}</code> and/or <code>{{DPL|eliminate}}</code>.
Line 138 ⟶ 156:
==Scrolling/URL
DPL3 supports efficient scrolling through huge result sets. Basically, the idea of backward scrolling is that the SQL statement produces a DESCENDING order (with titles below the threshold). Internally, DPL3 buffers the SQL result set and reverses its order. So, the user will see a page of entries directly below the threshold, but in ascending order.
The command <code>scroll=''yes''</code> must be given to enable scrolling.
===Scroll/URL syntax===
If scrolling is enabled, DPL3 1.8.0 and later will take some parameters from the URL command line (e.g., like <code>DPL_offset</code>); these parameters can be accessed within DPL3 via a special syntax:
* <code>{%DPL_offset%}</code>.
or
* <code>{%DPL_offset:defaultvalue%}</code>.
Within the DPL3 statement, you can access URL parameters via
Line 163 ⟶ 177:
'''Note:''' There is a template called [[Template:Extension DPL scroll]] which uses <code>DPL_offset</code> and <code>DPL_count</code> to provide a generic page scrolling method for huge result sets, where there is an expected number of results. See {{DPL|scroll}} for more information.
===Scroll/URL parameters===
When scrolling is enabled, DPL will interpret the following special parameters in the URL.
{| class="wikitable"
! URL Parameter
! Description
|-
|DPL_count
|Limit number of pages to show, overwrites the values of the <code>{{DPL|count}}=</code> parameter.
|-
|DPL_offset
|Where to start, n<sup>th</sup> page, overwrites the value of the <code>{{DPL|offset}}=</code> parameter.
|-
|DPL_refresh
|{{note|'''Note:''' This feature was removed in DPL3 version 3.0.0.|error}}
|-
|DPL_findTitle
|Page name to start with, value is passed to {{DPL|titlegt}}= (previously title>= ).
|-
|DPL_toTitle
|Page name to end with, value is passed to {{DPL|titlegt}} (previously title>), which is needed for reverse scroll and which restricts the selection to articles with a page title less or equal to the specified value.
|-
|DPL_fromTitle
|Page name to start after, value is passed to {{DPL|titlelt}} (previously title<), which and restricts the selection to articles with a page title greater or equal to the specified value.
|-
|DPL_scrolldir
|direction of scroll (can be 'up' or 'down').
|}
Line 207 ⟶ 243:
</ul>
</pre>
Line 260 ⟶ 285:
We'd also like to point out that there are two special commands named <code>{{DPL|table}}</code> and <code>{{DPL|tablerow}}</code> which make it quite easy to produce output in table form.
|