Examples/Parameter: scroll (example 2)

From DynamicPageList3 Manual
Revision as of 06:28, 28 April 2022 by imported>FrozenPlum (Finish refining this before I move it (it's going to be the second of 2 examples, the first didn't work I think because of caching change, which can be overridden))
Please do not edit this page unless you're wanting to edit the manual itself, it is an example included in the manual.

Example

This selects pages from Category:Fruit examples and sets display count to the first 3 articles. The scroll parameter enables scrolling and URL variables. The resultsheader argument uses a helper template (Template:Extension DPL scroll) to create the scrolling navigation. A magic word ({{PAGESINCATEGORY:Category}}) and some parameters are fed to that template, so it can determine the total number of pages and the amount to show and offset for the navigation display. allowcachedresults=false prevents caching, so result changes are immediately seen without the need to manually purge the cache.

{{#dpl:execandexit=geturlargs}}
{{#dpl:
|category      = Fruit examples
|count         = {%DPL_count:3%}
|offset        = {%DPL_offset:0%}
|scroll        = yes
|resultsheader = ²{Extension DPL 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 = ²{Extension DPL scroll¦total=7¦offset={%DPL_offset:0%}¦count={%DPL_count:3%}¦page=Examples/Parameter: scroll (example 2)}²\n |allowcachedresults = false }}