Other parameters: Difference between revisions
Content added Content deleted
imported>FrozenPlum m (Update link and example display) |
imported>FrozenPlum (Add more examples) |
||
Line 49: | Line 49: | ||
'''Notes:''' |
|||
All queries are cached by default '''to reduce server load''', as generally articles do not change often enough to require updating every page load. |
* All queries are cached by default '''to reduce server load''', as generally articles do not change often enough to require updating every page load. |
||
* If immediate updates are required every page load, such as for displaying {{DPL|scroll}} navigation via {{DPL|URL parameters}}, then set this parameter to false. |
|||
* Cache period is handled by the <code>{{DPL|cacheperiod}}</code> parameter. |
|||
Line 231: | Line 234: | ||
If no wiki text is given, the command is ignored. Otherwise, DPL3 outputs the wiki text and exits immediately. |
If no wiki text is given, the command is ignored. Otherwise, DPL3 outputs the wiki text and exits immediately. |
||
Note that the wiki text may be a parser function call which evaluates to an empty string. |
Note that the wiki text may be a parser function call which evaluates to an empty string. |
||
'''Example:'''<br><br><!-- transclude example from subpage-->{{#lsth:Examples/Parameter: execandexit (example 1)|Example}} |
|||
{{ViewTest|Examples|Parameter: execandexit (example 1)}} |
|||
'''Result:'''<br><br><!-- transclude example from subpage-->{{#lsth:Examples/Parameter: execandexit (example 1)|Result}} |
|||
The special word ''geturlargs'' can be used as a wiki text to transform URL arguments starting with <code>DPL_</code> into variables, which can then be accessed via #var (if the [[mw:Extension:Variables|Variables]] extension is installed) or via #dplvar. |
The special word ''geturlargs'' can be used as a wiki text to transform URL arguments starting with <code>DPL_</code> into variables, which can then be accessed via #var (if the [[mw:Extension:Variables|Variables]] extension is installed) or via #dplvar. |
||
Line 237: | Line 245: | ||
'''Example:'''<br><br><!-- transclude example from subpage-->{{#lsth:Examples/Parameter: execandexit (example 2)|Example}} |
|||
A typical use would look like this (note the double pipe symbols within the #if. |
|||
{{ViewTest|Examples|Parameter: execandexit (example 2)}} |
|||
Calling the following page with &DPL_cat=Country would list countries, omitting the <code>&cat</code> parameter would trigger the error text message (without DPL3 going to the database): |
|||
<pre><nowiki> |
|||
{{#dpl:execandexit=geturlargs}} |
|||
'''Result:'''<!-- transclude example from subpage-->{{#lsth:Examples/Parameter: execandexit (example 2)|Result}} |
|||
{{#dpl: |
|||
| execandexit = {{#if:{{#dplvar:DPL_cat}}||please specify a category via &DPL_cat= in the URL!}} |
|||
| resultsheader = pages in category {{#dplvar:DPL_cat}}:\n |
|||
| noresultsheader = there are no pages in category {{#dplvar:DPL_cat}}.\n |
|||
| count = 5 |
|||
| category = {{#dplvar:DPL_cat}} |
|||
}} |
|||
</nowiki></pre> |
|||
Line 254: | Line 255: | ||
'''Note:''' <code>execandexit</code> acts like a short-circuit evaluation. This means, for example, that successive statements to influence caching behavior (like <code>{{DPL|allowcachedresults}}</code>) are not interpreted. |
{{note|'''Note:''' <code>execandexit</code> acts like a short-circuit evaluation. This means, for example, that successive statements to influence caching behavior (like <code>{{DPL|allowcachedresults}}</code>) are not interpreted.}} |
||