Jump to content
This wiki has been automatically closed because there have been no edits or log actions made within the last 60 days. If you are a user (who is not the bureaucrat) that wishes for this wiki to be reopened, please request that at Requests for reopening wikis. If this wiki is not reopened within 6 months it may be deleted. Note: If you are a bureaucrat on this wiki, you can go to Special:ManageWiki and uncheck the "Closed" box to reopen it.

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:
 
:* [[Page 1Apple]]
:* [[Page 2Orange]]
:* [[Another PagePlum]]
 
==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 {{dpl3DPL|format}} option, for example).
* [[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 defineuse athe special[[mw:Help:Magic_words#Other|Magic template like,Word]] <code><nowiki>{{!}}</nowiki></code> which contains'hides' athe singlepipe from the MediaWiki parser, ensuring that it is [[mw:Help:Extension:ParserFunctions#Escaping pipe characters in tables|not considered until after]] other symbolitems ashave itsbeen contentsexpanded.
** 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 call[[mw:Help:Magic ofwords#Other|Magic aWord]] special template (which would typically be called "Template:<code><nowiki>{{!") }}</nowiki></code>which has'hides' a singlethe pipe characterfrom asthe itsMediaWiki contents.parser, Theensuring samethat kindit ofis tricknot isconsidered alsountil foundafter outsideother DPLitems inhave otherbeen templatesexpanded. The second example shows that the <code>¦</code> character acts as an alternative to this somewhat awkward notation.
 
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 [[{{DPL |format variables|variables]]}} which are implicitly set by DPL.
Example: <code>%TITLE%</code>, <code>%PAGE%</code>
 
Some [[{{DPL |format variables|variables]]}} can only be used in the header or footer, like e.g. <code>%PAGES%</code>, <code>%TOTALPAGES%</code>
 
==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 {{dpl3DPL|count}} parameter (in fact, it overwrites the value specified within the DPL statement)
* DPL_offset: influences the {{dpl3DPL|offset}} parameter (in fact, it overwrites the value specified within the DPL statement)
* 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 {{dpl3DPL|skipthispage}} gives you control over this behavior. By setting it to ''no'' you can allow self references in DPL result sets.
* You can suppress back references to a page containing a DPL query by using {{dpl3DPL|reset}} and/or {{dpl3DPL|eliminate}}.
 
==Symbol replacement in ''mode=userformat''==
Line 198:
resultsfooter=«/nowiki»«/pre»
 
The same effect can be achieved with {{dpl3DPL|debug}}=5.
 
==Table output==
We'd also like to point out that there are two special commands named {{dpl3DPL|table}} and {{dpl3DPL|tablerow}} which make it quite easy to produce output in table form.
 
==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&gt;</code> and <code>title&lt;</code> will implicitly be set. Within the {{dpl3DPL|resultsheader}} and/or {{dpl3DPL|resultsfooter}} you can call a template which generates links to fetch the next / previous page.
 
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]]
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.