Template:Previous: Difference between revisions
Content added Content deleted
imported>FrozenPlum m (FrozenPlum moved page Template:Direction to Template:Previous: Forgot I'd have to separate them anyhow) |
imported>FrozenPlum No edit summary |
||
Line 1: | Line 1: | ||
<noinclude>Creates previous |
<noinclude>Creates previous 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 page links from whatever the current <code><nowiki>{{PAGENAME}}</nowiki></code> is.</noinclude><includeonly>{{#dpl: |
||
|category={{{category|}}} |
|category={{{category|}}} |
||
|notcategory={{{notcategory|}}} |
|notcategory={{{notcategory|}}} |
||
|namespace={{{namespace|Main}}} |
|namespace={{{namespace|Main}}} |
||
|titlelt={{#titleparts: |
|titlelt={{#titleparts:{{PAGENAME}}}} |
||
|mode=inline |
|mode=inline |
||
|ordermethod=sortkey |
|ordermethod=sortkey |
||
|order= |
|order=descending |
||
|count=1 |
|count=1 |
||
|format=,<div style="text-align:< |
|format=,<div style="text-align:left;">[[File:Double arrow left.png|25px|link=%PAGE%]] [[%PAGE%|%TITLE%]]</div>, |
||
-->{{#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 -- |
|||
---->|ascending = [[%PAGE%|%TITLE%]] [[File:Double arrow.png|25px|link=%PAGE%]]<!-- |
|||
---->|[[File:Double arrow left.png|25px|link=%PAGE%]] [[%PAGE%|%TITLE%]]<!-- |
|||
-->}}</div>, |
|||
|debug={{{debug|0}}} |
|debug={{{debug|0}}} |
||
}}</includeonly><noinclude> |
}}</includeonly><noinclude> |
||
==Examples== |
==Examples== |
||
<pre>{{direction |
<pre>{{direction|category=Fruit examples}}</pre> |
||
'''Result:''' {{direction |
'''Result:''' {{direction|category=Fruit examples}} |
||
<pre>{{direction|ascending|category=Fruit examples}}</pre> |
|||
'''Result:''' {{direction|ascending|category=Fruit examples}} |
|||
==Notes== |
==Notes== |
||
The <code>#titleparts</code> section of the [[mw:Extension ParserFunctions|ParserFunctions]] page explains that [[mw:Help:Magic Words|Magic Words]] like <code><nowiki>{{PAGENAME}}</nowiki></code> |
The <code>#titleparts</code> section of the [[mw:Extension ParserFunctions|ParserFunctions]] page explains that [[mw:Help:Magic Words|Magic Words]] like <code><nowiki>{{PAGENAME}}</nowiki></code> occasionally return strings as needlessly HTML-encoded, this formerly caused DPL3 to not return results when page names contain <code>'</code> and other special characters. Use of <code><nowiki>{{#titleparts:{{PAGENAME}}}}</nowiki></code> HTML-decodes, converting it to plain text. |
||
==See also== |
|||
* [[Template:Navigation]] |
|||
* [[Template:Next]] |
|||
[[Category:Example templates]] |
[[Category:Example templates]] |
||
</noinclude> |
</noinclude> |
Revision as of 22:25, 1 October 2022
Creates previous 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 page links from whatever the current {{PAGENAME}}
is.
Examples
{{direction|category=Fruit examples}}
Result: {{#dpl: |category=Fruit examples |notcategory= |namespace=Main |titlelt=Previous |mode=inline |ordermethod=sortkey |order=descending |count=1
|format=,
,
|debug=0 }}
Notes
The #titleparts
section of the ParserFunctions page explains that Magic Words like {{PAGENAME}}
occasionally return strings as needlessly HTML-encoded, this formerly caused DPL3 to not return results when page names contain '
and other special characters. Use of {{#titleparts:{{PAGENAME}}}}
HTML-decodes, converting it to plain text.