Template:Previous: Difference between revisions
imported>FrozenPlum (Create a simple direction template for a DPL3 navigation example) |
imported>FrozenPlum (Fix I forgot) |
||
Line 8: | Line 8: | ||
|order={{{1|descending}}} |
|order={{{1|descending}}} |
||
|count=1 |
|count=1 |
||
|format=,<div style="text-align: |
|format=,<div style="text-align:<!-- |
||
-->{{#switch:{{{1|}}}<!-- See MediaWiki Help:Extension:ParserFunctions -- |
|||
---->|ascending = right<!-- if order ascending, text-align:right; |
|||
---->|left<!-- otherwise left |
|||
-->}};"><!-- |
|||
-->{{#switch:{{{1|}}}<!-- See MediaWiki Help:Extension:ParserFunctions -- |
-->{{#switch:{{{1|}}}<!-- See MediaWiki Help:Extension:ParserFunctions -- |
||
---->|ascending = [[%PAGE%|%TITLE%]] [[File:Double arrow.png|25px|link=%PAGE%]]<!-- |
---->|ascending = [[%PAGE%|%TITLE%]] [[File:Double arrow.png|25px|link=%PAGE%]]<!-- |
Revision as of 21:55, 1 October 2022
Creates previous/next navigation between items in a specified category. Is written to be embedded in another template to style as a navigation bar, and automatically generate previous/next from whatever the current {{PAGENAME}}
is.
Examples
{{direction|descending|category=Fruit examples}}
Result: {{#dpl: |category=Fruit examples |notcategory= |namespace=Main |titlelt=Previous |mode=inline |ordermethod=sortkey |order=descending |count=1
|format=,
,
|debug=0 }}
{{direction|ascending|category=Fruit examples}}
Result: {{#dpl: |category=Fruit examples |notcategory= |namespace=Main |titlelt=Previous |mode=inline |ordermethod=sortkey |order=ascending |count=1
|format=,
,
|debug=0 }}
Notes
The #titleparts
section of the ParserFunctions page explains that Magic Words like {{PAGENAME}}
(and others) return strings as needlessly HTML-encoded, this can occasionally cause DPL3 to not return results when page names contain '
and other special characters. Use of {{#titleparts:{{PAGENAME}}}}
HTML-decodes, converting it to plain text.