Difference between revisions of "DPL Example 013"
From FollowTheScore
								
												
				|  (New page: <pre><nowiki> {{#vardefine:count|10}}{{#vardefine:thispage|:DPL_Example_013}} {{#dpl:  |namespace=  |titlematch=C%  |count={{#var:count}}  |offset={{{offset|0}}}  |resultsfooter=   ²{#ife...) | |||
| Line 1: | Line 1: | ||
| − | + | 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.  | |
| + | |||
| + | To avoid redundancies we use the ''variables'' extension; thus the ''limit'' and the ''pagename'' can be defined at a single place. | ||
| + | |||
| + | ---- | ||
| + | |||
| {{#vardefine:count|10}}{{#vardefine:thispage|:DPL_Example_013}} | {{#vardefine:count|10}}{{#vardefine:thispage|:DPL_Example_013}} | ||
| {{#dpl: | {{#dpl: | ||
| Line 26: | Line 31: | ||
|      [[{{#var:thispage}}|''reset'']] |      [[{{#var:thispage}}|''reset'']] | ||
| }} | }} | ||
| − | |||
| − | |||
| − | |||
| − | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | <pre><nowiki> | ||
| {{#vardefine:count|10}}{{#vardefine:thispage|:DPL_Example_013}} | {{#vardefine:count|10}}{{#vardefine:thispage|:DPL_Example_013}} | ||
| {{#dpl: | {{#dpl: | ||
| Line 60: | Line 67: | ||
|      [[{{#var:thispage}}|''reset'']] |      [[{{#var:thispage}}|''reset'']] | ||
| }} | }} | ||
| + | </nowiki></pre> | ||
Revision as of 16:36, 9 May 2009
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.
To avoid redundancies we use the variables extension; thus the limit and the pagename can be defined at a single place.
{{#vardefine:count|10}}{{#vardefine:thispage|:DPL_Example_013}}
Extension:DynamicPageList (DPL), version 3.2.1: Warning: Skipping bad option '{{#var:count}}' for parameter 'count'.
- C
- CC
- Cache API
- Cache Demo 1
- Cache Demo 2
- Calendar
- Calendar zh-tw
- Calendar zh-tw/Demo
- Call extension
- Cameroon
- Cannot perform logical operations
- Cezanne
- Chess
- City A
- City B
- Class Freshman
- Class Game
- Class Location
- Class Musical Instrument
- Class Person
- Class Student
- Class Subject
- Class car
- Class test
- Class vehicle
- Current events
- Current events zh-tw
{{#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'']]
}}
