Examples/Parameter: scroll (example 1): Difference between revisions
miraheze:dpl3>CrystalClear (Fix example) |
imported>FrozenPlum m (Update categories and example text slightly) |
||
(One intermediate revision by the same user not shown) | |||
Line 6:
==Example==
This selects pages from [[:Category:Fruit examples]]. The <code>{{DPL|count}}</code> displays the first article using
Line 37:
<noinclude>
[[Category:Select by category-related criteria]]
[[Category:Uses execandexit parameter]]
[[Category:Uses category parameter]]
[[Category:Uses count
[[Category:Uses offset
[[Category:Uses scroll parameter]]
[[Category:Uses resultsheader parameter]]
[[Category:Uses URL parameter]]
[[Category:Uses resultsfooter parameter]]
[[Category:Uses allowcachedresults parameter]]
</noinclude>
|
Latest revision as of 07:24, 21 April 2023
Example
This selects pages from Category:Fruit examples. The count
displays the first article using URL parameters, and an empty offset
also using that syntax; setting both using scroll/url syntax, allows their query values to be overwritten by URL. The scroll
parameter fills the scroll/url parameter values. The resultsheader
displays header text to show the count and current result start number. Setting allowcachedresults=false
prevents caching, so result changes are immediately seen when the URL is changed, without the need to manually purge the MediaWiki cache.
The result is a static display of the first 3 pages, but their display offset (page to start at) and count can be overwritten just by adding two DPL3-specific URL parameters &DPL_count=1&DPL_offset=1
to the end of the (index.php-style) URL. If you copy/paste the URL into your browser's URL bar, you can see the next result is loaded from the URL parameters:
https://dpl3.miraheze.org/w/index.php?title=Criteria_for_page_selection/Parameter:_scroll_(example_1)&DPL_count=1&DPL_offset=1
{{#dpl:execandexit=geturlargs}} {{#dpl: |category = Fruit examples |count = {%DPL_count:1%} |offset = {%DPL_offset:0%} |scroll = yes |resultsheader = Showing {%DPL_count:1%} pages starting from page ²{#expr:{%DPL_offset%} + 1}²:\n |allowcachedresults = false }}
Result
{{#dpl:execandexit=geturlargs}} {{#dpl: |category = Fruit examples |count = {%DPL_count:1%} |offset = {%DPL_offset:0%} |scroll = yes |resultsheader = Showing {%DPL_count:1%} pages starting from page ²{#expr:{%DPL_offset%} + 1}²:\n |allowcachedresults = false }}