Anonymous user
General usage and invocation syntax: Difference between revisions
Add links to text where users might not want to manually search for the parameter or function being referred to.
imported>FrozenPlum m (Add note forgotten re:template working when there is an expected number of results, code format a few missed references) |
(Add links to text where users might not want to manually search for the parameter or function being referred to.) |
||
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'''.
;Sample output
Both of the following examples, which illustrate the difference between using DPL as a parser extension and using it as a parser function, will produce a list of all articles which belong to ''cat1'' or ''cat2'' and which contain a reference to ''myPage''. The output of these DPL calls would be something like:
==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 101:
Example: <code>%TITLE%</code>, <code>%PAGE%</code>
Some {{DPL|format|variables}} can only be used in the header or footer, like e.g. <code>%PAGES%</code>, <code>%TOTALPAGES%</code>.
{{note|For a complete list of built-in variables, see [[Controlling output format#variables|format variables]].}}
==URL parameters==
Line 239 ⟶ 240:
</nowiki></pre>
Calling <code><nowiki>http://mywebsite/mywiki/index.php?title=MyPopularArticles</nowiki></code> will give you the first 100 articles in the category. Adding <code>&DPL_offset=100</code> will give you the next one hundred articles. This mechanism can be used to create a generic page scroll feature—provided you can access the value of <code>DPL_offset</code> also in other templates outside DPL. And this is where the <code>{{DPL|execandexit}}</code> command comes in: it stores the URL parameters in a variable which can be accessed via <code>{{DPL|#dplvar}}</code>.
[[Category:Manual]]
|