Examples/Parameter: scroll (example 2): Difference between revisions

From DynamicPageList3 Manual
Content deleted Content added
imported>FrozenPlum
mNo edit summary
imported>FrozenPlum
Refine now that parent page is rewritten
Line 6: Line 6:
==Example==
==Example==


This selects pages from [[:Category:Fruit examples]] and sets display count to the first 3 articles. The <code>scroll</code> parameter enables scrolling and URL variables. The <code>resultsheader</code> argument uses a helper template ([[Template:Extension DPL scroll]]) to create the scrolling navigation. A [[mw:Help:Magic_words#Statistics|magic word]] (<code><nowiki>{{PAGESINCATEGORY:Category}}</nowiki></code>) 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. Setting <code>allowcachedresults=''false''</code> prevents caching, so result changes are immediately seen without the need to manually purge the cache.
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>resultsheader</code> uses a helper template ([[Template:Extension DPL scroll]]) to create scroll navigation, composed of [[mw:Help:Magic_words#Statistics|magic word]] (<code><nowiki>{{PAGESINCATEGORY:Category}}</nowiki></code>) and some parameters are fed to that template, so it can determine total pages, count, and amount of offset. <code>allowcachedresults</code> prevents caching, to prevent the need for manual purge.


<pre>
<pre>

Revision as of 08:13, 28 April 2022

Please do not edit this page unless you're wanting to edit the manual itself, it is an example included in the manual.

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 uses a helper template (Template:Extension DPL 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 = ²{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 }}