Template:DPL/0/doc

From Wikibooks, open books for an open world
Jump to navigation Jump to search

This is one of a series of subtemplates of {{DPL}} that display increments of a long list of pages.

Usage[edit source]

In addition to the parameters accepted by {{DPL}}, this subtemplate also accepts three other parameters.

  • {{{ping}}} — Optional. If non-blank, this subtemplate is only being called to make sure it exists.
  • {{{increment}}} — Required. An integer number of pages to be listed by each subtemplate in the series.
  • {{{n}}} Required. An integer that names this subtemplate. The first subtemplate in the series is called 0, the second is 1, and so on.

If {{{ping}}} is non-blank, this subtemplate simply returns "ping" without doing anything else. This makes it possible for each subtemplate in the series to look for the next subtemplate in the series without using expensive parser function {{#ifexist:}} (instead, simply ping the next subtemplate and compare the result to "ping").

Otherwise, this subtemplate first uses subtemplate {{DPL/simple}} to display up to {{{increment}}} pages of the list, and then calls the next subtemplate to display any remaining pages up to {{{count}}}.

The identity of the next subtemplate is determined via {{DPL/name next}}, which detects when there are no more subtemplates available in the series and in that case diverts the call to {{DPL/simple}}.

Of the parameters to {{DPL}}, {{{count}}} is required by this subtemplate; if {{DPL}} is not provided a value for this parameter, it calls {{DPL/simple}} directly, bypassing the numbered series of subtemplates. {{{count}}} and {{{offset}}} are adjusted by each numbered subtemplate when it calls the next subtemplate. {{{showerror}}} is passed from {{DPL}} to {{DPL/0}}, and is passed from each numbered subtemplate in its initial call to {{DPL/simple}}, but is nulled when calling the next subtemplate — so that if non-null showerror is passed to {{DPL}}, it is only passed on to the first call to {{DPL/simple}}.

Extending the series[edit source]

To extend the series, check Special:PrefixIndex/Template:DPL/ to see what the next numbered subtemplate would be, and create that template with exactly the same content as all the preceding numbered subtemplates.