Examples/Parameter: titlelt (example 2)
Example
This example creates navigation between pages in Category:Fruit examples, by combining three templates: {{previous}}, {{next}}, and {{navigation}}.
Previous Content
The {{previous}} template contains content similar to:
{{#dpl: |category={{{category|}}} |namespace= |titlelt={{PAGENAME}} |mode=inline |ordermethod=title |order=descending |count=1 |format=,<div style="text-align:left;">[[File:Double arrow left.png|25px|link=%PAGE%|alt=<]] [[%PAGE%|%TITLE%]]</div>, }}
{{{category|}}}
allows a category parameter value to be passed to DPL3 to select pages from a specific category, in the default (blank) namespace, whose title is before/previous (alphabetically) to the current page title (without Namespace). Inline formatting is used, ordered by title in descending order, displaying only 1 result, and using an arrow image with page title beside it, both linked to the previous page title.
Next Content
The {{previous}} template contains content similar to:
{{#dpl: |category={{{category|}}} |namespace= |titlegt={{PAGENAME}} |mode=inline |ordermethod=title |order=descending |count=1 |format=,<div style="text-align:left;">[[File:Double arrow left.png|25px|link=%PAGE%|alt=<]] [[%PAGE%|%TITLE%]]</div>, }}
Functions the same as the {{previous}} template, only |titlegt={{PAGENAME}}
fetches the page title after/next (alphabetically) to the current page title (without Namespace).
The {{previous}} template contains content similar to:
{| style="width:100%; border:1px solid lightgrey; background:#e9f4f9;" |style="width:40%;"|{{previous|category={{{category|}}}}} |style="width:20%; text-align:center;"|[[:Category:{{{category|}}}|{{{category|}}}]] |style="width:40%;"|{{next|category={{{category|}}}}} |}
This template formats a navigation bar, and calls the {{previous}} and {{next}} DPL3 templates in the first and last columns of a 3 column table. The {{{category|}}}
parameter passes the |category=Fruit examples
value (see next section) to both the {{previous}} and {{next}} templates, which then feed it to the DPL3 statement in each template. The middle column is used to link to the specified category page.
Combined use on-page
The navigation template is used on a page and passes the Fruit examples category name as follows:
{{navigation|category=Fruit examples}}
Result
{{#dpl: | debug=0 | category=Fruit examples | notcategory= | namespace=Main | titlelt=Examples/Parameter: titlelt (example 2) | mode=inline | ordermethod=title | order=descending | count=1 | format=,,
}} |
Fruit examples | {{#dpl: | debug=0 | category=Fruit examples | notcategory= | namespace=Main | titlegt=Examples/Parameter: titlelt (example 2) | mode=inline | ordermethod=title | order=ascending | count=1 | format=,,
}} |