Anonymous user
Other parameters: Difference between revisions
Add more examples
imported>FrozenPlum m (Fix a couple more things I couldn't see on first edit) |
imported>FrozenPlum (Add more examples) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 12:
'''Syntax:'''
<code>debug=<i>n</i></code>, where
* <code>''0''</code>
* <code>''1''</code>
* <code>''2''</code>
* <code>''3''</code>
* <code>''4''</code>
* <code>''5''</code>
{{note|'''Note:''' If the debug
'''Example:'''<br><br><!-- transclude example from subpage-->{{#lsth:Examples/Parameter: debug (example 1)|Example}}
'''Example:'''▼
{{ViewTest|Examples|Parameter: debug (example 1)}}
'''Result:'''<br><br><!-- transclude example from subpage-->{{#lsth:Examples/Parameter: debug (example 1)|Result}}
DPL debug messages are translatable in ''DynamicPageList2.i18n.php''.▼
<code>debug=1</code> will suppress warning messages (e.g., if the result set of a DPL query is empty). As an alternative, the <code>{{DPL|suppresserrors}}=</code> statement can be used.▼
▲* <code>debug=''1''</code>
Line 50 ⟶ 44:
'''Syntax:'''
<code>allowcachedresults=''value''</code> where
* <code>''true''</code>
* <code>''false''</code> – prevent caching.
'''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, 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 61 ⟶ 58:
{{DPL Parameter
|name = cacheperiod
|purpose=
}}
Line 67 ⟶ 64:
'''Syntax:'''
<code>cacheperiod=''number of seconds''</code>
Line 73 ⟶ 70:
{{DPL Parameter
|name = goal
|purpose= Set the
}}
Line 79 ⟶ 76:
'''Syntax:'''
<code>goal=''goaltype''</code> where
* <code>''pages''</code>
* <code>''categories''</code>.
If the goal parameter is set to 'categories' the list of pages is still be produced, but is not seen. Instead, it is
This allows the asking of question like: Given all pages that are a member of category ''X'' with a title matching ''"y%"'' and which use template ''"Z"'': to which categories do these pages belong?
Line 96 ⟶ 93:
The output of
Line 107 ⟶ 104:
{{DPL Parameter
|name = eliminate
|purpose= Suppress references to pages, templates, images, categories in
}}
Line 113 ⟶ 110:
'''Syntax:'''
<code>eliminate=''keyword,..''</code> where
* <code>''categories''</code>
* <code>''templates''</code>
* <code>''images''</code>
* <code>''links''</code>
* <code>''all''</code>
The output of a
*
* It shares ('adopts') their use of templates.
* It shares their references to images.
* It shares their references to other articles.
In some cases, this may be useful. But in many cases, this is not wanted. Especially when
The <code>eliminate</code> parameter
For further explanation, see <code>{{DPL|reset}}</code>.
'''Note:''' The use of <code>eliminate</code> needs a considerable amount of extra computing power as it performs a second parser step for each included document.
Line 140 ⟶ 137:
{{DPL Parameter
|name = reset
|purpose= Suppress references to pages, templates, images, categories in
}}
Line 146 ⟶ 143:
'''Syntax:'''
<code>reset=''keyword,..''</code>, where
* <code>''categories''</code>
* <code>''templates''</code>
* <code>''images''</code>
* <code>''links''</code>
* <code>''all''</code>
The output of a
*
*
*
*
In some cases, this may be useful. But in many cases, this is not wanted. Especially when
The <code>reset</code> parameter
There are some subtle differences here depending on the mode in which DPL3 is used. These differences affect the question of how links, and categories etc., are treated which are direct part of the document containing the DPL3 query.
Line 177 ⟶ 174:
To avoid the above described effect of <code>reset</code> on one's 'own' links, <code>{{DPL|eliminate}}</code> can be used. However, it is important to note that ''eliminate'' is rather expensive in terms of computer power, as it does a second parse for all included contents.
Using <code>reset</code> in parser function mode clears everything, regardless of whether it comes from included contents or whether it is direct part of the document containing the DPL3 query.
To avoid the above described effect of <code>reset</code>, <code>{{DPL|eliminate}}</code> can be used. However, ''eliminate'' is rather expensive in terms of computing power, as it does a second parse for all included contents. The extra parser step is conducted as soon
If there is '''more than one DPL3 query''' in a page, the effects depend on the exact mode (parser extension or parser function mode), on the sequence of the statements and on the presence of 'reset' or 'eliminate' statements in each of the queries and on their individual arguments. As this is a very rare case, only a simple rule of thumb is given here: Once 'reset' is used in parser function mode or
Line 215 ⟶ 212:
Use multiple commands to assign the article to more than one category.
If <code>reset=''all''</code> or <code>reset=''categories''</code> are used, the article containing the DPL3 statement is not be recorded in the
As a side effect of using <code>reset=''all''</code>, the article
Line 235 ⟶ 232:
If no wiki text is given, the command
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}}
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 Variables extension is installed) or via #dplvar.▼
{{ViewTest|Examples|Parameter: execandexit (example 1)}}
'''Result:'''<br><br><!-- transclude example from subpage-->{{#lsth:Examples/Parameter: execandexit (example 1)|Result}}
Using this command, DPL3 can be prevented from executing a database query; this may be useful if a necessary parameter was not given by the user. Note that an ''#if'' function call would NOT help in that case because ''#if'' evaluates its complete content before taking the "if" or the "else" path. So, emebdding a DPL3 call within a #if is much less efficient than using the ''execandexit'' function.▼
▲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.
▲Using this command, DPL3 can be prevented from executing a database query; this may be useful if
'''Example:'''<br><br><!-- transclude example from subpage-->{{#lsth:Examples/Parameter: execandexit (example 2)|Example}}
''See also:''' [[Template:Extension DPL scroll]] and {{DPL|scrolling}}▼
{{ViewTest|Examples|Parameter: execandexit (example 2)}}
'''Result:'''<!-- transclude example from subpage-->{{#lsth:Examples/Parameter: execandexit (example 2)|Result}}
'''Note:''' <code>execandexit</code> acts like a short-circuit evaluation. This means, for example, that successive statements to influence caching behaviour (like {{DPL|allowcachedresults}}) will not be interpreted.▼
▲{{note|'''Note:''' <code>execandexit</code> acts like a short-circuit evaluation. This means, for example, that successive statements to influence caching
Line 278 ⟶ 273:
''rule'';
Where ''rule'' is one of the following:
# '''Rules for batch update of articles'''
#* A DPL3 query can select a group of articles and perform updates, like inserting a piece of text at a certain position, or changing text portions based on regular expressions.
Line 327 ⟶ 322:
====before ''pattern'';====
Defines locations where text will be inserted. The location(s)
The regexp will implicitly be enclosed in slashes. Hence, literal slash characters must be escaped by backslashes.
Line 333 ⟶ 328:
====after ''pattern'';====
Defines locations where text will be inserted. The location(s)
The regexp will implicitly be enclosed in slashes. Hence, literal slash characters must be escaped by backslashes.
Line 341 ⟶ 336:
Defines the text to be inserted.
A DPL3 statement may contain replacement, insertion, before, and after at the same time.
<pre>
replace /([a-z]+])-cat/;
by \1-dog;
Line 348 ⟶ 344:
after foo;
insert bar2;
</pre>
Only one
Line 356 ⟶ 353:
The name of the template; the prefix "Template:" must be given.
The regexp will implicitly be enclosed in slashes. Hence, literal slash characters must be escaped by backslashes.
after ''pattern'';
insert ''text'';
replace ''pattern'';
by ''replacement'';
For safety reasons, the update statements are only performed if "exec yes" is specified. So, leaving this away, what would happen if the update were to be executed can be checked.
Note that if "exec yes" is present, the update is performed each time the page is rendered which contains the DPL3 statement
The size of the form fields
<!--To make the use of the <code>updaterules</code> feature easier, we provide a [[Template:Bulk Update|special user interface]].
Line 390 ⟶ 389:
This command is experimental at the moment.
This
[[Category:Primary Module|05]]
|