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

From DynamicPageList3 Manual
Content added Content deleted
imported>FrozenPlum
imported>FrozenPlum
m (Update categories and example text slightly)
 
(4 intermediate revisions by 2 users not shown)
Line 6: Line 6:
==Example==
==Example==


This selects pages from [[:Category:Fruit examples]] which has a number of results. The <code>{{DPL|count}}</code> displays the first 3 articles, the <code>{{DPL|offset}}</code> doesn't change the article count offset because it's set to zero; setting both using a URL variables instead of a number, allows their query values to overwritten. The <code>scroll</code> parameter enables scrolling and changes to the DPL3 query (for changing the values for <code>count</code> and <code>offset</code> in order to scroll). The <code>resultsheader</code> displays some header text along with the count and current page start number. Setting <code>allowcachedresults=''false''</code> prevents caching, so result changes are immediately seen without the need to manually purge the cache.
This selects pages from [[:Category:Fruit examples]]. The <code>{{DPL|count}}</code> displays the first article using {{DPL|URL parameters}}, and an empty <code>{{DPL|offset}}</code> also using that syntax; setting both using scroll/url syntax, allows their query values to be overwritten by URL. The <code>{{DPL|scroll}}</code> parameter fills the scroll/url parameter values. The <code>{{DPL|resultsheader}}</code> displays header text to show the count and current result start number. Setting <code>{{DPL|allowcachedresults}}=''false''</code> 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 pages, adding two URL <code>&DPL_count=3&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 on-page to change; the next 3 results in the result set are displayed. You can copy/paste the following URL into your web browser to see the result change.
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 <code>&DPL_count=1&DPL_offset=1</code> to the end of the ([[mw:Manual:Parameters_to_index.php|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:


* <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>
* <code><nowiki>https://dpl3.miraheze.org/w/index.php?title=Criteria_for_page_selection/Parameter:_scroll_(example_1)&DPL_count=1&DPL_offset=1</nowiki></code>


<pre>
<pre>
Line 17: Line 17:
{{#dpl:
{{#dpl:
|category = Fruit examples
|category = Fruit examples
|count = {%DPL_count:3%}
|count = {%DPL_count:1%}
|offset = {%DPL_offset:0%}
|offset = {%DPL_offset:0%}
|scroll = yes
|scroll = yes
|resultsheader = Showing {%DPL_count:3%} pages starting from page ²{#expr:{%DPL_offset%} + 1}²:\n
|resultsheader = Showing {%DPL_count:1%} pages starting from page ²{#expr:{%DPL_offset%} + 1}²:\n
|allowcachedresults = false
|allowcachedresults = false
}}
}}
Line 29: Line 29:
{{#dpl:
{{#dpl:
|category = Fruit examples
|category = Fruit examples
|count = {%DPL_count:3%}
|count = {%DPL_count:1%}
|offset = {%DPL_offset:0%}
|offset = {%DPL_offset:0%}
|scroll = yes
|scroll = yes
|resultsheader = Showing {%DPL_count:3%} pages starting from page ²{#expr:{%DPL_offset%} + 1}²:\n
|resultsheader = Showing {%DPL_count:1%} pages starting from page ²{#expr:{%DPL_offset%} + 1}²:\n
|allowcachedresults = false
|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 parameter]]
[[Category:Uses count parameter]]
[[Category:Uses offset 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]]
[[Category:Uses allowcachedresults parameter]]
</noinclude>
</noinclude>

Latest revision as of 07:24, 21 April 2023

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. 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 }}