DPL Example 013
From Dpldemo
This example demonstrates how a big result set can be split into several pages. The central idea is to use the Call extension as a vehicle for calling the original page with a varying parameter for the offset. The resultsfooter is used to offer a link to the Call extension; in this link the new offset is calculated.
To avoid redundancies we use the variables extension; thus count (aka limit) and pagename can be defined at a single place.
1..10 11..20 reset (total 27)
{{#vardefine:count|10}}{{#vardefine:thispage|:DPL_Example_013}}
{{#dpl:
|namespace=
|titlematch=C%
|count={{#var:count}}
|offset={{{offset|0}}}
|resultsfooter=
²{#ifexpr:%TOTALPAGES% > {{#var:count}}¦
\n-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br/>
{{#ifexpr:{{{offset|0}}} > 0|
[[Special:Call/{{#var:thispage}},offset={{#expr:{{{offset}}} - {{#var:count}}}}¦{{#expr:{{{offset}}} - {{#var:count}} + 1}}..{{{offset}}}]]
}}
'''{{#expr:{{{offset|0}}} + 1}}..{{#expr:{{{offset|0}}} + {{#var:count}}}}'''
²{#ifexpr:%TOTALPAGES% - {{#var:count}} > {{{offset|0}}}¦
²{#ifexpr:%TOTALPAGES% - 2 * {{#var:count}} <= {{{offset|0}}}¦
[[Special:Call/{{#var:thispage}},offset={{#expr:{{{offset|0}}} + {{#var:count}}}}|{{#expr:{{{offset|0}}} + {{#var:count}} + 1}}..%TOTALPAGES%]]¦
[[Special:Call/{{#var:thispage}},offset={{#expr:{{{offset|0}}} + {{#var:count}}}}|{{#expr:{{{offset|0}}} + {{#var:count}} + 1}}..{{#expr:{{{offset|0}}} + 2 * {{#var:count}}}}]]
}²
}²
[[{{#var:thispage}}|reset]] (total %TOTALPAGES%)
}²
|noresultsfooter=no more results<br/>-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --<br/>
²{#ifexpr:{{{offset|0}}} > 0¦
[[Special:Call/{{#var:thispage}},offset={{#expr:{{{offset}}} - {{#var:count}}}}¦{{#expr:{{{offset}}} - {{#var:count}} + 1}}..%TOTALPAGES%]] }²
[[{{#var:thispage}}|''reset'']]
}}