Anonymous user
General usage and invocation syntax: Difference between revisions
m
Update DPL3 template use to DPL template (not reliant on loops and vars), fix section about using "!" template (was replaced by magic word), put code format on code bits consistently.
imported>FrozenPlum m (TOC to the top where it belongs) |
imported>FrozenPlum m (Update DPL3 template use to DPL template (not reliant on loops and vars), fix section about using "!" template (was replaced by magic word), put code format on code bits consistently.) |
||
Line 7:
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 method==
Line 25:
;Parsing procedure
Wiki markup expansion ''does not take place'' before the commands are handed over to the extension module.
* This may be useful if you want to pass wiki syntax elements to DPL3 as arguments (see the {{
* [[mw:Magic words|Magic words]] like <code><nowiki>{{PAGENAME}}</nowiki></code> or <code><nowiki>{{CURRENTDAY}}</nowiki></code> '''cannot''' be used.
* Template calls, like <code><nowiki>{{some template}}</nowiki></code>, cannot be used as parameters.
Line 61:
;Syntax features
* To use wiki characters as arguments, escape them.<!--need link to what this means-->
** It is possible to
** With DPL it is also possible to use the symbol <code>¦</code> instead of <code>|</code>; this is very intuitive, and maybe it could be adopted by MediaWiki in general...but be <u>careful</u>: it must be inserted by copy-and-paste from here (or from an HTML symbol or extended ASCII table like Windows' ''Character Map'') as normally a keyboard will not have it available (even worse: on some keyboards the standard pipe character is printed in a way that it looks more like the "broken pipe").
* The text can (but needs not) be written in one line of text, parameters are separated by pipe characters.
* What was said before regarding explicit line breaks also holds true for parser function syntax, i.e., the special symbols <code>\n</code> or <code>¶</code> must be used to insert an explicit linefeed character into the wiki output stream if wiki symbols are used which must stand at the beginning of a line.
Note: The pipe character, which is used to define a logical OR for the two categories, must be represented as a
The second example is not literally equivalent to the first one, as there is an additional pipe character before the first parameter. Technically, this creates an additional empty parameter, but as empty parameters are silently ignored by DPL it makes no difference.
Line 98:
==Built-in variables==
Within a DPL statement, you can use some
Example: <code>%TITLE%</code>, <code>%PAGE%</code>
Some
==URL parameters==
DPL understands a couple of parameters which can be passed via a URL specification. These URL-parameters all start with DPL_:
* DPL_count: influences the {{
* DPL_offset: influences the {{
* DPL_refresh: if used with a value of 'yes' this will clear the DPL cache
* DPL_fromTitle: restrict the selection to articles with a page title greater or equal to the specified value
Line 167:
<center style="border:1px black solid"><big>'''''Normally DPL does not return its own page in the result.'''''</big></center>
* The parameter {{
* You can suppress back references to a page containing a DPL query by using {{
==Symbol replacement in ''mode=userformat''==
Line 198:
resultsfooter=«/nowiki»«/pre»
The same effect can be achieved with {{
==Table output==
We'd also like to point out that there are two special commands named {{
==Scrolling==
Line 208:
The command <code>scroll=yes</code> must be given to enable scrolling.
DPL can take certain URL parameters from the command line, like <code>&DPL_fromTitle</code> and <code>&DPL_toTitle</code>. If these arguments are given, the commands <code>title></code> and <code>title<</code> will implicitly be set. Within the {{
Basically, the idea of backward scrolling is that the SQL statement produces a DESCENDING order (with titles below the threshold). Internally, DPL 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.
Line 239:
</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>execandexit</code> command comes in: it stores the URL parameters in a variable which can be accessed via #dplvar.
[[Category:Manual]]
|