Examples/Parameter: scroll (example 2): Difference between revisions
imported>FrozenPlum No edit summary |
imported>FrozenPlum m Update category links and a few other things |
||
(12 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
==Example== |
==Example== |
||
The <code>{{DPL|count}}</code> and empty <code>{{DPL|offset}}</code> displays the first 3 articles from [[:Category:Fruit examples]] using [[General usage and invocation syntax#Scroll/URL syntax|Scroll/URL syntax]], and <code>scroll</code> fills the scroll/url parameter values. The <code>{{DPL|resultsheader}}</code>/footer use a helper template ([[Template:DPL3 scroll]]) to create scroll navigation, composed of [[mw:Help:Magic_words#Statistics|magic word]] (<code><nowiki>{{PAGESINCATEGORY:</nowiki>''Category''}}</code>) and some parameters are fed to that template, so it can determine total pages, count, and amount of offset. <code>{{DPL|allowcachedresults}}</code> prevents caching, to prevent the need for manual purge. |
|||
This selects pages from [[:Category:Fruit examples]] and sets the count to display the first 3 articles in that category (using a URL variable instead of a number, so the count can be overwritten as needed). The <code>scroll</code> parameter enables scrolling through the category result set, and also enables support for the use of URL variables to change the DPL3 query. The <code>resultsheader</code> displays text that gives the <code>DPL_count</code> variable value, and the current {{DPL|offset}} value. |
|||
Adding <code>&DPL_offset=3</code> to the end of the ([[mw:Manual:Parameters_to_index.php|index.php]]-style) URL seen below, causes the contents of the DPL3 query displayed on-page to change; the next 3 results in the result set are displayed. |
|||
<code><nowiki>https://dpl3.miraheze.org/w/index.php?title=Criteria_for_page_selection/Parameter:_scroll_(example_1)&DPL_count=3&DPL_offset=3</nowiki></code> |
|||
<pre> |
<pre> |
||
Line 19: | Line 15: | ||
|offset = {%DPL_offset:0%} |
|offset = {%DPL_offset:0%} |
||
|scroll = yes |
|scroll = yes |
||
|resultsheader = ²{ |
|resultsheader = ²{DPL3 scroll¦total={{PAGESINCATEGORY:Fruit examples|R}}¦offset={%DPL_offset:0%}¦count={%DPL_count:3%}¦page={{FULLPAGENAME}}}²\n |
||
|resultsfooter = ²{DPL3 scroll¦total={{PAGESINCATEGORY:Fruit examples|R}}¦offset={%DPL_offset:0%}¦count={%DPL_count:3%}¦page={{FULLPAGENAME}}}²\n |
|||
|allowcachedresults = false |
|||
}} |
}} |
||
</pre> |
</pre> |
||
Line 31: | Line 29: | ||
|offset = {%DPL_offset:0%} |
|offset = {%DPL_offset:0%} |
||
|scroll = yes |
|scroll = yes |
||
|resultsheader = ²{ |
|resultsheader = ²{DPL3 scroll¦total={{PAGESINCATEGORY:Fruit examples|R}}¦offset={%DPL_offset:0%}¦count={%DPL_count:3%}¦page={{FULLPAGENAME}}}²\n |
||
|resultsfooter = ²{DPL3 scroll¦total={{PAGESINCATEGORY:Fruit examples|R}}¦offset={%DPL_offset:0%}¦count={%DPL_count:3%}¦page={{FULLPAGENAME}}}²\n |
|||
|allowcachedresults = false |
|||
}} |
}} |
||
<noinclude> |
<noinclude> |
||
[[Category:Select by category-related criteria]] |
[[Category:Select by category-related criteria]] |
||
[[Category:Uses execandexit parameter]] |
|||
[[Category:Uses category parameter]] |
[[Category:Uses category parameter]] |
||
[[Category:Uses count |
[[Category:Uses count parameter]] |
||
[[Category:Uses offset parameter]] |
|||
[[Category:Uses scroll parameter]] |
[[Category:Uses scroll parameter]] |
||
[[Category:Uses resultsheader parameter]] |
[[Category:Uses resultsheader parameter]] |
||
[[Category:Uses URL parameter]] |
|||
[[Category:Uses resultsfooter parameter]] |
|||
[[Category:Uses allowcachedresults parameter]] |
|||
</noinclude> |
</noinclude> |
Latest revision as of 07:22, 21 April 2023
Example
The count
and empty offset
displays the first 3 articles from Category:Fruit examples using Scroll/URL syntax, and scroll
fills the scroll/url parameter values. The resultsheader
/footer use a helper template (Template:DPL3 scroll) to create scroll navigation, composed of magic word ({{PAGESINCATEGORY:Category}}
) and some parameters are fed to that template, so it can determine total pages, count, and amount of offset. allowcachedresults
prevents caching, to prevent the need for manual purge.
{{#dpl:execandexit=geturlargs}} {{#dpl: |category = Fruit examples |count = {%DPL_count:3%} |offset = {%DPL_offset:0%} |scroll = yes |resultsheader = ²{DPL3 scroll¦total={{PAGESINCATEGORY:Fruit examples|R}}¦offset={%DPL_offset:0%}¦count={%DPL_count:3%}¦page={{FULLPAGENAME}}}²\n |resultsfooter = ²{DPL3 scroll¦total={{PAGESINCATEGORY:Fruit examples|R}}¦offset={%DPL_offset:0%}¦count={%DPL_count:3%}¦page={{FULLPAGENAME}}}²\n |allowcachedresults = false }}
Result
{{#dpl:execandexit=geturlargs}} {{#dpl: |category = Fruit examples |count = {%DPL_count:3%} |offset = {%DPL_offset:0%} |scroll = yes |resultsheader = ²{DPL3 scroll¦total=7¦offset={%DPL_offset:0%}¦count={%DPL_count:3%}¦page=Examples/Parameter: scroll (example 2)}²\n |resultsfooter = ²{DPL3 scroll¦total=7¦offset={%DPL_offset:0%}¦count={%DPL_count:3%}¦page=Examples/Parameter: scroll (example 2)}²\n |allowcachedresults = false }}