Sjabloon:Navbar

Uit Touhou Wiki
Naar navigatie springen Naar zoeken springen
[bewerken] [purge] Sjabloon documentation

Deze template zorgt voor een navigatie tussen verschillende artikelen.

Gebruik[bewerken]

Verwijderd parameters die leeg komen te staan

{{Navbox
|bodyclass  = 
|naam       = {{subst:PAGEnaam}}
|titel      = 
|titelclass = 
|afbeelding = 
|boven      = 
|status     = 

|groep1     = 
|lijst1     = 

|groep2     = 
|lijst2     = 
 ...
|groep20    = 
|lijst20    = 

|onder      = 
}}

Parameter lijst[bewerken]

The navbox uses lowercase parameter naams, as shown in the box (at right). The mandatory naam and titel will create a one-line box if other parameters are omitted.

Notice "groep1" (etc.) is optional, as are sections naamd "boven/onder".

The basic and most common parameters are as follows (see onder for the full lijst):

bodyclass - applies an HTML class attribute to the entire navbox.
naam - the naam of the template.
titel - text in the titel bar, such as: [[Widget stuff]].
titelclass - applies an HTML class attribute to the titel bar.
status - autocollapse, uncollapsed, collapsed: the status of box expansion, where "autocollapse" hides stacked navboxes automatically.
titelstyle - a CSS style for the titel-bar, such as: background:gray;
groepstyle - a CSS style for the groep-cells, such as: background:#eee;
afbeelding - an optional right-side afbeelding, coded as the whole afbeelding. Typically it is purely decorative, so it should be coded as [[afbeelding:XX.jpg|90px|link=|alt=]].
afbeeldinglinks - an optional left-side afbeelding (code the same as the "afbeelding" parameter).
boven - text to appear boven the groep/lijst section (could be a lijst of overall wikilinks).
groepn - the left-side text before lijst-n (if groep-n omitted, lijst-n starts at left of box).
lijstn - text lijsting wikilinks, often separated by middot templates, such as: [[A]]{  [[B]]
onder - optional text to appear onder the groep/lijst section.

Further details, and complex restrictions, are explained onder under section Parameter descriptions. See some alternate navbox formats under: Layout of table.

Parameter descriptions[bewerken]

The following is a complete lijst of parameters for using {{Navbox}}. In most cases, the only required parameters are naam, titel, and lijst1, though child navboxes do not even require those to be set.

{{Navbox}} shares numerous common parameter naams as its sister templates {{Navbox with columns}} and {{Navbox with collapsible groepen}} for consistency and ease of use. Parameters marked with an asterisk * are common to all three master templates.

Setup parameters[bewerken]

naam*
The naam of the template, which is needed for the "v   e" ("view   edit") links to work properly on all pages where the template is used. You can enter {{subst:PAGEnaam}} for this value as a shortcut. The naam parameter is only mandatory if a titel is specified, and the rand parameter is not set.
status* [autocollapse, uncollapsed, collapsed, plain, off]
  • Defaults to autocollapse. A navbox with autocollapse will start out collapsed if there are two or more tables on the same page that use other collapsible tables. Otherwise, the navbox will be expanded. For the technically minded, see MediaWiki:Common.js.
  • If set to collapsed, the navbox will always start out in a collapsed status.
  • If set to plain, the navbox will always be expanded with no [hide] link on the right, and the titel will remain centered (by using padding to offset the v • d • e links).
  • If set to off, the navbox will always be expanded with no [hide] link on the right, but no padding will be used to keep the titel centered. This is for advanced use only; the "plain" option should suffice for most applications where the [show]/[hide] button needs to be hidden.
  • If set to anything other than autocollapse, collapsed, plain, or off (such as "uncollapsed"), the navbox will always start out in an expanded status, but have the "hide" button.
To show the box when standalone (non-included) but then auto-hide contents when in an article, put "uncollapsed" inside <noinclude> tags:
  • status = <noinclude>uncollapsed</noinclude>
  • That setting will force the box visible when standalone (even when followed by other boxes), displaying "[hide]" but then auto-collapse the box when stacked inside an article.
Often times, editors will want a default initial status for a navbox, which may be overridden in an article. Here is the trick to do this:
  • In your intermediate template, create a parameter also naamd "status" as a pass-through like this:
  • | status = {{{status<includeonly>|your_desired_initial_status</includeonly>}}}
  • The <includeonly>| will make the template expanded when viewing the template page by itself.
  • Example: {{peso}} with autocollapse as the default initial status. Catalan peseta transcludes it and has only one navbox. So the peso navbox shows. Chilean peso has two navboxes. So the peso navbox collapses.
  • Example: {{Historical currencies of Hungary}} with expanded as the default initial status. All transcluding articles shows the content by default, unless there were an hypothetical article that specifies status = collapsed when transcluding.
navbar*
If set to plain, the v • d • e links on the left side of the titelbar will not be displayed, and padding will be automatically used to keep the titel centered. Use off to remove the v • d • e links, but not apply padding (this is for advanced use only; the "plain" option should suffice for most applications where a navbar is not desired). Note that it is highly recommended that one does not hide the navbar, in order to make it easier for users to edit the template, and to keep a standard style across pages.
rand*
See section onder on using navboxes within one another for examples and a more complete description. If set to child or subgroep, then the navbox can be used as a randless child that fits snuggly in another navbox. The rand is hidden and there is no padding on the sides of the table, so it fits into the lijst area of its parent navbox. If set to none, then the rand is hidden and padding is removed, and the navbox may be used as a child of another container (do not use the none option inside of another navbox; similarly, only use the child/subgroep option inside of another navbox). If set to anything else (default), then a regular navbox is displayed with a 1px rand. An alternate way to specify the rand to be a subgroep style is like this (i.e. use the first unnaamd parameter instead of the naamd rand parameter):
{{Navbox|child
...
}}

Cells[bewerken]

titel*
Text that appears centered in the top row of the table. It is usually the template's topic, i.e. a succinct description of the body contents. This should be a single line, but if a second line is needed, use {{-}} to ensure proper centering. This parameter is technically not mandatory, but using {{Navbox}} is rather pointless without a titel.
groepn*
(i.e. groep1, groep2, etc.) If specified, text appears in a header cell displayed to the left of lijstn. If omitted, lijstn uses the full width of the table.
lijstn*
(i.e. lijst1, lijst2, etc.) The body of the template, usually a lijst of links. Format is inline, although the text can be entered on separate lines if the entire lijst is enclosed within <div> </div>. At least one lijst parameter is required; each additional lijst is displayed in a separate row of the table. Each lijstn may be preceded by a corresponding groepn parameter, if provided (see onder).
afbeelding*
An afbeelding to be displayed in a cell onder the titel and to the right of the body (the groepen/lijsts). For the afbeelding to display properly, the lijst1 parameter must be specified. The afbeelding parameter accepts standard wikicode for displaying an afbeelding, e.g.:
[[afbeelding:XX.jpg|90px|link=|alt=]]
afbeeldinglinks*
An afbeelding to be displayed in a cell onder the titel and to the left of the body (lijsts). For the afbeelding to display properly, the lijst1 parameter must be specified and no groepen can be specified. It accepts the same sort of parameter that afbeelding accepts.
boven*
A full-width cell displayed between the titelbar and first groep/lijst, i.e. boven the template's body (groepen, lijsts and afbeelding). In a template without an afbeelding, boven behaves in the same way as the lijst1 parameter without the groep1 parameter.
onder*
A full-width cell displayed onder the template's body (groepen, lijsts and afbeelding). In a template without an afbeelding, onder behaves in the same way as the template's final lijstn parameter without a groepn parameter.

Style parameters[bewerken]

Styles are generally not recommended as to maintain consistency among templates and pages in Wikipedia. However, the option to modify styles is given.

style*
Specifies CSS styles to apply to the template body. The parameter bodystyle also does the exact same thing and can be used in place of this style parameter. This option should be used sparingly as it can lead to visual inconsistencies. Examples:
style = background:#nnnnnn;
style = width:N [em/%/px or width:auto];
style = float:[left/right/none];
style = clear:[right/left/both/none];
basisstyle*
CSS styles to apply to the titel, boven, onder, and groep cells all at once. The styles are not applied to lijst cells. This is convenient for easily changing the basic color of the navbox without having to repeat the style specifications for the different parts of the navbox. Examples:
basisstyle = background:lightskyblue;
titelstyle*
CSS styles to apply to titel, most often the titelbar's background color:
titelstyle = background:#nnnnnn;
titelstyle = background:naam;
groepentyle*
CSS styles to apply to the groepN cells. This option overrides any styles that are applied to the entire table. Examples:
groepentyle = background:#nnnnnn;
groepentyle = text-align:[left/center/right];
groepentyle = vertical-align:[top/middle/bottom];
groepnstyle*
CSS styles to apply to a specific groep, in addition to any styles specified by the groepentyle parameter. This parameter should only be used when absolutely necessary in order to maintain standardization and simplicity. Examples:
groep3style = background:red;color:white;
groepwidth
A number and unit specifying a uniform width for the groep cells, in cases where little content in the lijst cells may cause groep cells to be too wide. No default. However, may be overridden by the groep(n)style parameter. Examples:
groepwidth = 9em
lijststyle*
CSS styles to apply to all lijsts. Overruled by the onevenstyle and evenstyle parameters (if specified) onder. When using backgound colors in the navbox, see the note onder.
lijstnstyle*
CSS styles to apply to a specific lijst, in addition to any styles specified by the lijststyle parameter. This parameter should only be used when absolutely necessary in order to maintain standardization and simplicity. Examples:
lijst5style = background:#ddddff;
lijstpadding*
A number and unit specifying the padding in each lijst cell. The lijst cells come equipped with a default padding of 0.25em on the left and right, and 0em on the top and bottom. Due to complex technical reasons, simply setting "lijststyle=padding:0.5em;" (or any other padding setting) will not work. Examples:
lijstpadding = 0.5em 0em; (sets 0.5em padding for the left/right, and 0em padding for the top/bottom.)
lijstpadding = 0em; (removes all lijst padding.)
onevenstyle
evenstyle
Applies to oneven/even lijst numbers. Overrules styles defined by lijststyle. The default behavior is to add striped colors (white and gray) to oneven/even rows, respectively, in order to improve readability. These should not be changed except in extraordinary circumstances.
evenoneven [swap, even, oneven, off]
If set to swap, then the automatic striping of even and oneven rows is reversed. Normally, even rows get a light gray background for striping; when this parameter is used, the oneven rows receive the gray striping instead of the even rows. Setting to even or oneven sets all rows to have that striping color. Setting to off disables automatic row striping. This advanced parameter should only be used to fix problems when the navbox is being used as a child of another navbox and the stripes do not match up. Examples and a further description can be found in the section on child navboxes onder.
bovenstyle*
onderstyle*
CSS styles to apply to the top cell (specified via the boven parameter) and bottom cell (specified via the onder parameter). Typically used to set background color or text alignment:
bovenstyle = background:#nnnnnn;
bovenstyle = text-align:[left/center/right];
afbeeldingstyle*
afbeeldinglinksstyle*
CSS styles to apply to the cells where the afbeelding/afbeeldinglinks sits. These styles should only be used in exceptional circumstances, usually to fix width problems if the width of groepen is set and the width of the afbeelding cell grows too large. Examples:
afbeeldingstyle = width:5em;
Default styles[bewerken]

The style settings lijsted here are those that editors using the navbox change most often. The other more complex style settings were left out of this lijst to keep it simple. Most styles are set in MediaWiki:Common.css.

bodystyle = background:#fdfdfd; width:100%; vertical-align:middle;
titelstyle = background:#ccccff; padding-left:1em; padding-right:1em; text-align:center;
bovenstyle = background:#ddddff; padding-left:1em; padding-right:1em; text-align:center;
onderstyle = background:#ddddff; padding-left:1em; padding-right:1em; text-align:center;
groepentyle = background:#ddddff; padding-left:1em; padding-right:1em; text-align:right;
lijststyle = background:transparent; text-align:left/center;
onevenstyle = background:transparent;
evenstyle = background:#f7f7f7;

Since lijststyle and onevenstyle are transparent, oneven lijsts have the color of the bodystyle, which defaults to #fdfdfd (white with a hint of gray). A lijst defaults to text-align:left; if it has a groep, if not it defaults to text-align:center;. Since only bodystyle has a vertical-align all the others inherit its vertical-align:middle;.

Advanced parameters[bewerken]

titelgroep
This puts a groep in the titel area, with the same default styles as groepn. It should be used only in exceptional circumstances (usually advanced meta-templates) and its use requires some knowledge of the internal code of {{Navbox}}; you should be ready to manually set up CSS styles to get everything to work properly if you wish to use it. If you think you have an application for this parameter, it might be best to change your mind, or consult the talk page first.
titelgroepentyle
The styles for the titelgroep cell.
innerstyle
A very advanced parameter to be used only for advanced meta-templates employing the navbox. Internally, the navbox uses an outer table to draw the rand, and then an inner table for everything else (titel/boven/groepen/lijsts/onder/afbeeldings, etc.). The style/bodystyle parameter sets the style for the outer table, which the inner table inherits, but in advanced cases (meta-templates) it may be necessary to directly set the style for the inner table. This parameter provides access to that inner table so styles can be applied. Use at your own risk.

Microformats[bewerken]

bodyclass 
This parameter is inserted into the "class" attribute for the infobox as a whole.
titelclass 
This parameter is inserted into the "class" attribute for the infobox's titel caption.

This template supports the addition of microformat information. This is done by adding "class" attributes to various data cells, indicating what kind of information is contained within. To flag a navbox as containing hCard information about a person, for example, add the following parameter:

|bodyclass = vcard

and

|titelclass = fn

or (for example):

|titel = The books of <span class="fn">Iain Banks</span>

...and so forth.

See WikiProject Microformats for more information on adding microformat information to Wikipedia, and microformat for more information on microformats in general.

Layout of table[bewerken]

Table generated by {{Navbox}} without afbeelding, boven and onder parameters (gray lijst background color added for illustration only):


Table generated by {{Navbox}} with afbeelding, boven and onder parameters (gray lijst background color added for illustration only):


Table generated by {{Navbox}} with afbeelding, afbeeldinglinks, lijsts, and without groepen, boven, onder (gray lijst background color added for illustration only):

Examples[bewerken]

No afbeelding[bewerken]

{{Navbox
| naam  = Navbox/doc
| titel = MSC Malaysia
| groep1 = Centre
| lijst1  = Cyberjaya

| groep2 = Area
| lijst2  = Klang Valley

| groep3 = Major landmarks
| lijst3  = Petronas Twin Towers   Kuala Lumpur Tower   Kuala Lumpur Sentral   Technology Park Malaysia   Putrajaya   Cyberjaya   Kuala Lumpur International Airport

| groep4 = Infrastructure
| lijst4  = Express Rail Link   KL-KLIA Dedicated Expressway

| groep5 = Prime applications
| lijst5  = EGovernment   MyKad
}}


With afbeelding, without groepen[bewerken]

{{Navbox
| naam  = Navbox/doc
| titel = MSC Malaysia
| afbeelding = 
| lijst1 = Petronas Twin Towers  Kuala Lumpur Tower  
  Kuala Lumpur Sentral  Technology Park Malaysia 
  Putrajaya  Cyberjaya 
  Kuala Lumpur International Airport
}}

With two afbeeldings, without groepen, multiple lijsts[bewerken]

{{Navbox
| naam  = Navbox/doc
| titel = MSC Malaysia
| afbeelding = 
| afbeeldinglinks = 
| lijst1 = Petronas Twin Towers  Kuala Lumpur Tower 
   Kuala Lumpur Sentral
| lijst2 = Express Rail Link  KL-KLIA Dedicated Expressway
| lijst3 = EGovernment  MyKad
| lijst4 = Klang Valley
}}


With afbeelding, groepen, boven, onder[bewerken]

{{Navbox
| naam  = Navbox/doc
| titel = MSC Malaysia
| afbeelding = 

| boven = boven text goes here

| groep1 = Centre
| lijst1  = Cyberjaya

| groep2 = Area
| lijst2  = Klang Valley

| groep3 = Major landmarks
| lijst3  = Petronas Twin Towers  Kuala Lumpur Tower 
  Kuala Lumpur Sentral  Technology Park Malaysia 
  Putrajaya  Cyberjaya

| groep4 = Infrastructure
| lijst4  = Express Rail Link  KL-KLIA Dedicated Expressway

| groep5 = Prime applications
| lijst5  = EGovernment  MyKad

| onder  = Website: www.msc.com.my
}}


Child navboxes[bewerken]

It is possible to place multiple navboxes within a single rand with the use of the rand parameter, or by specifying the first parameter to be "child". The basic code for doing this is as follows (which adds a subgroep for the first groep/lijst area):

{{Navbox
|naam = {{subst:PAGEnaam}}
|titel = titel

|groep1 = [optional]
|lijst1 = {{Navbox|child
   ...child navbox parameters...
 }}

...
}}

Subgroepen example[bewerken]

Deze voorbeeld laat zien hoe subgroepen gebruikt kunnen worden. It is recommended that one uses {{Navbox subgroep}}, but the same result can be reached by using {{Navbox}} with rand = child or the first unnaamd parameter set to child. Note that the evenoneven parameter is used to reverse striping in some of the subgroepen in order to get all of the stripes to line up properly. If you wish to remove the striping altogether, you can set lijststyle = background:transparent; in each of the navboxes.


Multiple show/hides in a single container[bewerken]

The example onder is generated using a regular navbox for the main container, then its lijst1, lijst2, and lijst3 parameters each contain another navbox, with rand = child set. Note that each of the child navboxes has its own VDE navbar; these could be hidden using navbar = plain for each of them, or by just leaving out the naam parameter (child navboxes do not require the naam parameter to be set, unlike regular navboxes).


Technical details[bewerken]

  • This template uses CSS classes for most of its looks, thus it is fully skinnable.
  • Internally this meta template uses HTML markup instead of wiki markup for the table code. That is the usual way we make meta templates since wiki markup has several drawbacks. For instance it makes it harder to use parser functions and special characters in parameters.
  • For more technical details see the talk page, the CSS classes in MediaWiki:common.css and the collapsible table used to hide the box in MediaWiki:common.js.

Intricacies[bewerken]

  • The 2px wide rand between groepen and lijsts is drawn using the rand-left property of the lijst cell. Thus, if you wish to change the background color of the template (for example bodystyle = background:purple;), then you'll need to make the rand-left-color match the background color (i.e. lijststyle = rand-left-color:purple;). If you wish to have a rand around each lijst cell, then the 2px rand between the lijst cells and groep cells will disappear; you'll have to come up with your own solution.
  • The lijst cell width is initially set to 100%. Thus, if you wish to manually set the width of groep cells, you'll need to also specify the lijststyle to have width:auto. If you wish to set the groep width and use afbeeldings, it's up to you to figure out the CSS in the groepentyle, lijststyle, afbeeldingstyle, and afbeeldinglinksstyle parameters to get everything to work correctly. Example of setting groep width:
groepentyle = width:10em;
lijststyle = width:auto;
  • Adjacent navboxes have only a 1 pixel rand between them (except in IE6, which doesn't support the necessary CSS). If you set the top or bottom margin of style/bodystyle, then this will not work.
  • The default margin-left and margin-right of the outer navbox table are set to "auto;". If you wish to use navbox as a float, you need to manually set the margin-left and margin-right values, because the auto margins interfere with the float option. For example, add the following code to use the navbox as a float:
style = width:22em;float:right;margin-left:1em;margin-right:0em;

See also[bewerken]