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

no edit summary
imported>FrozenPlum
(Not sure why examples how to scroll etc were on a general use and syntax page, but make it only so this has general use and syntax (the rest moved where it belonged), and, there were 3 or for disparate places for scroll info, there's now just this syntax/reference, and the main source (has 2 identically named sections on selection critera page too))
imported>FrozenPlum
No edit summary
Line 2:
{{DPL manual|section=General usage and invocation syntax}}
{{tocright}}
 
 
'''DynamicPageList3 (DPL3)''' can be used as a '''parser extension''' (<small><code><nowiki><dpl> .... </dpl></nowiki></code></small>) or as a '''parser function''' (<small><code><nowiki>{{#dpl: .... }}</nowiki></code></small>). There is no general rule which one is better. If in doubt, you may want to use the '''parser function syntax''', as it '''is more powerful'''.
 
Line 12 ⟶ 14:
* [[Orange]]
 
 
==Invocation syntax==
==Syntax used in this manual==
 
Most examples in this manual typically use the parser function-based syntax <code><nowiki>{{#dpl:}}</nowiki></code> given it is the more flexible syntax. Examples are wrapped in <code><nowiki><pre></pre></nowiki></code> tags, so the plain wikitext used to create a result can be seen without rendering the result itself.
 
Most of the manual deals with the explanation of individual parameters. This is independent of the choice between the two variants described above. So, if you read something like
* parameter = value
you should have in mind that you must either place DPL3 tags around (using a separate line for each parameter) or use the parser function syntax and separate parameters by pipe characters.
 
 
==DPL3 Invocation syntax==
===Parser extension (tag) method===
The following example would probably be used directly on an article page, but could also be included as part of a template. Parser extensions define a specific tag (in this case <code><nowiki><dpl></nowiki></code>) and a corresponding end tag (<code><nowiki></dpl></nowiki></code>). '''The text between these tags is handed over to the extension module ''just as it is''.'''
Line 85 ⟶ 97:
 
 
==Special note on ''Self References''==
===#dplchapter===
 
In principle a DPL3 query could be written in a way that the page containing the query (or the page including a template which contains the query) would be part of the result set. Experience in the past has shown that in some cases this leads to unwanted effects. For instance, the page containing the query from a MediaWiki point of view contains links to all pages it lists. If your DPL3 statement contains a "uses" clause, you will be astonished to find your own page in all results. The same happens with categories... In addition, there were technical problems with self referencing result sets (parser loop references, which seemed very hard to solve). So, it was decided to skip a self reference in the result set by default.
Besides '''#dpl''' there is another parser function which you can use in your wiki text. It is called '''[[#dplchapter]]''' and extracts the body of a chapter from some arbitrary wiki text which it receives as a parameter.
 
 
{{note|'''Important:''' DPL3 does not normally return its own page (a self link/reference) in the result set. To include a page that references itself in the result, you must use <code>{{DPL|skipthispage}}{{=}}''no''</code>|error}}
 
 
You can suppress back references to a page containing a DPL3 query by using <code>{{DPL|reset}}</code> and/or <code>{{DPL|eliminate}}</code>.
 
 
Line 138 ⟶ 156:
 
 
==Scrolling/URL parametersParameters==
 
DPL3 supports efficient scrolling through huge result sets. Basically, the idea of backward scrolling is that the SQL statement produces a DESCENDING order (with titles below the threshold). Internally, DPL3 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.
 
The command <code>scroll=''yes''</code> must be given to enable scrolling.
DPL3 understands a couple of parameters which can be passed via a URL specification. These URL-parameters all start with DPL_:
* <code>DPL_count</code>: Influences the <code>{{DPL|count}}</code> parameter which limits the number of pages to show, it overwrites the value specified within the DPL3 statement.
* <code>DPL_offset</code>: Influences the <code>{{DPL|offset}}</code> parameter, it overwrites the value specified within the DPL3 statement and specifies where to start (n<sup>th</sup> page).
* <code>DPL_refresh</code>: Specifies whether or not to purge the cache ('yes' will clear the DPL3 cache).
* <code>DPL_fromTitle</code>: Influences the <code>{{DPL|titlelt}}</code> (previously title<), specifies the page name to start after, so restricts the selection to articles with a page title greater or equal to the specified value.
* <code>DPL_toTitle</code>: Influences the <code>{{DPL|titlegt}}</code> (previously title>), specifies the page name to end with, so restricts the selection to articles with a page title less than or equal to the specified value.
* <code>DPL_findTitle</code>: Influences the <code>{{DPL|titlegt}}</code> parameter, specifies the page name to start with that is passed to {{DPL|titlegt}}.
* <code>DPL_arg1, DPL_arg2, .. DPL_arg5</code>: Generic parameters that can be used freely to influence a DPL3 statement.
 
 
===Scroll/URL syntax===
The command following would display ''MyPage'' and set the offset parameter to a value of ''20'':
 
<pre><nowiki> http://mywebsite/mywiki/index.php?title=MyPage&DPL_offset=20 </nowiki></pre>
 
If scrolling is enabled, DPL3 1.8.0 and later will take some parameters from the URL command line (e.g., like <code>DPL_offset</code>); these parameters can be accessed within DPL3 via a special syntax:
* <code>{%DPL_offset%}</code>.
or
* <code>{%DPL_offset:defaultvalue%}</code>.
 
Within the DPL3 statement, you can access URL parameters via
Line 163 ⟶ 177:
 
 
'''Note:''' There is a template called [[Template:Extension DPL scroll]] which uses <code>DPL_offset</code> and <code>DPL_count</code> to provide a generic page scrolling method for huge result sets, where there is an expected number of results. See {{DPL|scroll}} for more information.
 
 
===Scroll/URL parameters===
==Syntax used in this manual==
 
When scrolling is enabled, DPL will interpret the following special parameters in the URL.
Most examples in this manual typically use the parser function-based syntax <code><nowiki>{{#dpl:}}</nowiki></code> given it is the more flexible syntax. Examples are wrapped in <code><nowiki><pre></pre></nowiki></code> tags, so the plain wikitext used to create a result can be seen without rendering the result itself.
 
{| class="wikitable"
Most of the manual deals with the explanation of individual parameters. This is independent of the choice between the two variants described above. So, if you read something like
! URL Parameter
* parameter = value
! Description
you should have in mind that you must either place DPL3 tags around (using a separate line for each parameter) or use the parser function syntax and separate parameters by pipe characters.
|-
|DPL_count
|Limit number of pages to show, overwrites the values of the <code>{{DPL|count}}=</code> parameter.
|-
|DPL_offset
|Where to start, n<sup>th</sup> page, overwrites the value of the <code>{{DPL|offset}}=</code> parameter.
|-
|DPL_refresh
|{{note|'''Note:''' This feature was removed in DPL3 version 3.0.0.|error}}
|-
|DPL_findTitle
|Page name to start with, value is passed to {{DPL|titlegt}}= (previously title>= ).
|-
|DPL_toTitle
|Page name to end with, value is passed to {{DPL|titlegt}} (previously title>), which is needed for reverse scroll and which restricts the selection to articles with a page title less or equal to the specified value.
|-
|DPL_fromTitle
|Page name to start after, value is passed to {{DPL|titlelt}} (previously title<), which and restricts the selection to articles with a page title greater or equal to the specified value.
|-
|DPL_scrolldir
|direction of scroll (can be 'up' or 'down').
|}
 
 
Line 207 ⟶ 243:
</ul>
</pre>
 
 
==Special note on ''Self References''==
 
In principle a DPL3 query could be written in a way that the page containing the query (or the page including a template which contains the query) would be part of the result set. Experience in the past has shown that in some cases this leads to unwanted effects. For instance, the page containing the query from a MediaWiki point of view contains links to all pages it lists. If your DPL3 statement contains a "uses" clause, you will be astonished to find your own page in all results. The same happens with categories... In addition, there were technical problems with self referencing result sets (parser loop references, which seemed very hard to solve). So, it was decided to skip a self reference in the result set by default.
 
 
{{note|'''Important:''' DPL3 does not normally return its own page (a self link/reference) in the result set. To include a page that references itself in the result, you must use <code>{{DPL|skipthispage}}{{=}}''no''</code>|error}}
 
 
You can suppress back references to a page containing a DPL3 query by using <code>{{DPL|reset}}</code> and/or <code>{{DPL|eliminate}}</code>.
 
 
Line 260 ⟶ 285:
 
We'd also like to point out that there are two special commands named <code>{{DPL|table}}</code> and <code>{{DPL|tablerow}}</code> which make it quite easy to produce output in table form.
 
 
==Scrolling==
 
DPL3 supports efficient scrolling through huge result sets. Basically, the idea of backward scrolling is that the SQL statement produces a DESCENDING order (with titles below the threshold). Internally, DPL3 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.
 
The command <code>scroll=''yes''</code> must be given to enable scrolling.
 
 
===Scroll variable syntax===
 
If scrolling is enabled, DPL3 1.8.0 and later will take some parameters from the URL command line (e.g., like <code>DPL_offset</code>); these parameters can be accessed within DPL3 via a special syntax:
* <code>{%DPL_offset%}</code>.
or
* <code>{%DPL_offset:defaultvalue%}</code>.
 
 
===Scroll variables===
 
When scrolling is enabled, DPL will interpret the following special parameters in the URL.
 
 
{| class="wikitable"
! URL Parameter
! Description
|-
|DPL_count
|Limit number of pages to show, overwrites the values of the <code>{{DPL|count}}=</code> parameter.
|-
|DPL_offset
|Where to start, n<sup>th</sup> page, overwrites the value of the <code>{{DPL|offset}}=</code> parameter.
|-
|DPL_refresh
|{{note|'''Note:''' This feature was removed in DPL3 version 3.0.0.|error}}
|-
|DPL_findTitle
|Page name to start with, value is passed to {{DPL|titlegt}}= (previously title>= ).
|-
|DPL_toTitle
|Page name to end with, value is passed to {{DPL|titlegt}} (previously title>), which is needed for reverse scroll and which restricts the selection to articles with a page title less or equal to the specified value.
|-
|DPL_fromTitle
|Page name to start after, value is passed to {{DPL|titlelt}} (previously title<), which and restricts the selection to articles with a page title greater or equal to the specified value.
|-
|DPL_scrolldir
|direction of scroll (can be 'up' or 'down').
|}
 
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.