Other parameters: Difference between revisions

Add more examples
imported>FrozenPlum
m (Fix formatting in a few places, still need to split out some examples but first will have to test the fix to %TOTALPAGES% used for scroll behaviour)
imported>FrozenPlum
(Add more examples)
 
(One intermediate revision by the same user not shown)
Line 24:
 
 
'''Example:'''<br><br><!-- transclude example from subpage-->{{#lsth:Examples/ModuleParameter: debug (example 1)|Example}}
{{ViewTest|Examples|ModuleParameter: debug (example 1)}}
 
'''Result:'''<br><br><!-- transclude example from subpage-->{{#lsth:Examples/Parameter: debug (example 1)|Result}}
 
 
Line 47 ⟶ 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. If immediate updates are required every page load, then set this parameter to false. Cache period is handled by the <code>{{DPL|cacheperiod}}</code> parameter.
* 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 229 ⟶ 234:
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.
 
'''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.
Line 235 ⟶ 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>
 
 
'''See also:''' [[Template:Extension DPLDPL3 scroll]] and {{DPL|scrolling}}.
 
 
{{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.}}
 
 
Anonymous user