Template:Prevnext2: Difference between revisions

    From KDE UserBase Wiki
    (Undo revision 258207 by Claus chr (talk))
    (avoid little empty box when no prevpage or nextpage is given)
    (One intermediate revision by the same user not shown)
    Line 1: Line 1:
    <includeonly><ul class="pager">
    <includeonly><ul class="pager">
    <li>{{#if: {{{prevpage|}}} | [[{{{prevpage}}}|&larr; {{#if: {{{prevtext|}}}|{{{prevtext}}}|{{{prevpage}}}}}}}}]] | }}</li>
    {{#if: {{{prevpage|}}} | <li>[[{{{prevpage}}}|&larr; {{{prevtext|{{{prevpage}}}}}}]]</li> | }}
    <li>'''{{#if: {{{index|}}} | [[{{{index}}}|&uarr; {{{indextext|{{PAGENAME}}}}} &uarr;]] | {{{indextext|{{PAGENAME}}}}}}}'''</li>
    <li>'''{{#if: {{{index|}}} | [[{{{index}}}|&uarr; {{{indextext|{{PAGENAME}}}}} &uarr;]] | {{{indextext|{{PAGENAME}}}}}}}'''</li>
    <li>{{#if: {{{nextpage|}}} | [[{{{nextpage}}}|{{#if: {{{nexttext|}}}|{{{nexttext}}}|{{{nextpage}}}}}}}} &rarr;]] | }}</li>
    {{#if: {{{nextpage|}}} | <li>[[{{{nextpage}}}|{{{nexttext|{{{nextpage}}}}}} &rarr;]]</li> | }}
    </ul></includeonly><noinclude>
    </ul></includeonly><noinclude>


    Line 21: Line 21:


    <tt><nowiki>{{Prevnext2</nowiki><br><nowiki>
    <tt><nowiki>{{Prevnext2</nowiki><br><nowiki>
    | prevpage  = The path of the previous article.*</nowiki><br><nowiki>
    | prevpage  = The path of the previous article.</nowiki><br><nowiki>
    | prevtext  = The link name for prevpage.*</nowiki><br><nowiki>
    | prevtext  = The link name for prevpage.*</nowiki><br><nowiki>
    | nextpage  = The path to the next article.*</nowiki><br><nowiki>
    | nextpage  = The path to the next article.*</nowiki><br><nowiki>

    Revision as of 08:32, 20 July 2019


    The old code was

    <includeonly><table align=center id=toc style="width: 95%" class="noprint"><tr>
    <td style="text-align: left; width: 33%">{{#if: {{{prevpage|}}} | [[{{{prevpage}}}|← {{{prevtext|{{{prevpage}}}}}}]] | }}</td>
    <td style="text-align: center; width:   33%">'''{{#if: {{{index|}}} | [[{{{index}}}|↑ {{{indextext|{{PAGENAME}}}}} ↑]] | {{{indextext|{{PAGENAME}}}}}}}'''</td>
    <td style="text-align: right; width: 33%">{{#if: {{{nextpage|}}} | [[{{{nextpage}}}|{{{nexttext|{{{nextpage}}}}}} →]] | }}</td>
    </tr></table></includeonly><noinclude>

    Information

    This template is a work-in-progress and will probably be re-named to something less obtuse quite soon, so avoid using it just at the moment.


    Use this template when you want to provide links to the previous and the next sections of the article so the user isn't forced to go back to the index to navigate.


    Arguments

    {{Prevnext2
    | prevpage = The path of the previous article.
    | prevtext = The link name for prevpage.*
    | nextpage = The path to the next article.*
    | nexttext = The link name for nextpage.*
    | index = The path to the manual index.*
    | indextext = The link name for index.*
    }}


    (* - Optional arguments.)

    Example usage

    Writing this:


    {{Prevnext2
    | prevpage=path/to/article | nextpage=path/to/article
    | prevtext=previous section| nexttext=The next section
    }}

    Gets you this:



    Example usage: omitting arguments

    Writing this:

    {{Prevnext2
    | nextpage=path/to/article
    | nexttext=The next section
    }}

    Gets you this:



    Writing this:

    {{Prevnext2
    | prevpage=path/to/article
    | prevtext=previous section
    }}

    Gets you this:



    Example usage: the least amount of typing

    Writing this:

    {{Prevnext2
    | nextpage=path/to/article
    | prevpage=path/to/lastsection
    }}

    Gets you this:



    Example usage: including every argument

    Writing this:

    {{Prevnext2
    | prevpage=path/to/article | nextpage=path/to/article
    | prevtext=previous section | nexttext=The next section
    | index= {{PAGENAME}}/Manual | indextext=Contents page
    }}

    Gets you this:



    Writing this:

    {{Prevnext2
    | nextpage=path/to/article
    | nexttext=The next section
    | indextext=Contents section
    }}

    Gets you this: