Template:LinkBar

From OWASP
Revision as of 12:07, 15 June 2013 by T.Gigler (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Purpose

Generates a bar that can contain navigation links of "Previous", "Main" and "Next" type.

The links themselves are generated by including other templates into this template. The names of the inner templates are passed as parameters.

Usage

{{LinkBar
  | useprev=PREV_LINK_TEMPLATE | prev=PREV_LINK_TARGET | lblprev=PREV_LINK_LABEL
  | usemain=MAIN_LINK_TEMPLATE | main=MAIN_LINK_TARGET | lblmain=MAIN_LINK_LABEL
  | usenext=NEXT_LINK_TEMPLATE | next=NEXT_LINK_TARGET | lblnext=NEXT_LINK_LABEL
}}

It is up to the inner template whether it will use the target and the label provided to it as parameters. If a label parameter is omitted or empty, the inner template is expected to use the target of the links will be used as labels, too. If both the label and the target parameters are omitted or empty, the inner template is expected to handle the situation gracefully (for example by generating a hardcoded link).

This is supported:

{{LinkBar
  | useprev=TemplateUsuallyTakingTwoParameters | prev=PREV_LINK_TARGET
  | usemain=NoParametersTemplate
  | usenext=TemplateUsuallyTakingTwoParameters
}}

When you include this template you can also choose an inner template that you control, so you can also implement your own custom handling of omitted or empty parameters.

Example inner templates for useprev

Nothing
Does not generate a link.
Ignores any parameters.
Can be used in a series in the first article, which does not have a previous article.
PrevLink
Generates a link like ««this««.
Supports target parameter and optional label parameter.
2010PrevLink
Is used by Top 10 2010.
Supports only the target parameter.

Example inner templates for usemain

Nothing
Does not generate a link.
Ignores any parameters.
MainLink
Generates a link with a multilingual part of the label.
Supports target parameter and optional label parameter.
Top_10_2010-CenterLink
Generates hardcoded links.
Ignores any parameters.

Example inner templates for usenext

Nothing
Does not generate a link.
Ignores any parameters.
Can be used in a series in the last article, which does not have a next article.
NextLink
Generates a link like »»this»».
Supports target parameter and optional label parameter.
2010NextLink
Is used by Top 10 2010.
Supports only the target parameter.

Inner Template Requirements

The inner templates are expected to generate a link, possibly with ornamentation (arrows, extra text,...). The inner templates must accept zero, one or two parameters.

  • If no parameters are provided, the template must display something that makes sense in the place of a central link in a navigation link bar: nothing, static text, a hardcoded link etc.
  • If the first parameter is provided, it represents the target of the link or a fragment of the target, which will be completed by the inner template to a working link. If the second parameter is missing or empty, the inner template must use the first parameter as label, too.
  • If the second parameter is provided in addition to the first, it represents the label of the link.