Help:Templates/Useful

From Computer Science Wiki
Jump to navigation Jump to search

This wiki has a large number of templates installed, and it can be difficult to keep track of which ones are actually useful! This page introduces the templates that are more likely to be of interest to normal users of this wiki, along with some simple examples - more details for each template will generally be given on the template's page, and links will be provided for each template.

The FlagBox templates

The FlagBox templates can be used to add various sorts of information boxes to pages. The core {{FlagBox}} template is actually a convenience wrapper around {{ambox}}, removing some of the fiddly aspects of using that template directly, while the other Flag* templates are even simpler to use, but far more specialised.

  • {{FlagBox}} - a simplified, generic message/information box template that you may use in your pages. Several styles are available, each style includes an image and coloured box to indicate the type and severity of the message, and you may use any text you want as the box content.

The remaining Flag* templates do not allow you to select the image or text shown in the box, so they are only useful in very specific situations. They are listed here just in case they prove useful, however:

  • {{FlagAbuse}} - part of the FlagPage extension, can be used to mark a page or section as containing vandalism or other abuse.
  • {{FlagDelete}} - part of the FlagPage extension, used to mark pages or sections for deletion.
  • {{FlagFactCheck}} - part of the FlagPage extension, can be used to mark pages or sections that need to be checked for accuracy.
  • {{FlagMaintenance}} - part of the FlagPage extension, marks pages or sections that need the attention of an admin to fix problems.

The MenuBox templates

The MenuBox templates allow the user to easily create content boxes for menu pages like those found on the Main Page. There are three different templates to choose from (click on any of them to go to the template's documentation):

  • {{MenuBox}} - a single box, with optional title, that spans most of the page. The contents of the box can be anything you choose.
  • {{MenuBox double}} - two boxes next to each other, with optional titles. Both boxes can contain anything you want.
  • {{MenuBox linkbox}} - two boxes next to each other, with optional titles. The boxes contain optional images, and lists of links.

For examples of these templates in use, the best place to go is the Main Page - that demonstrates the MenuBox and MenuBox linkbox templates in a real use situation.

The Navbox template

{{Navbox}} is an extremely poweful - and, unfortunately, rather complex - template that allows you to create navigation boxes to include in pages. MediaWiki's page navigation on its own leaves a very great deal to be desired, and {{Navbox}} can go a long way towards remedying the situation.

The {{Navbox}} page contains full documentation for the template, but very little that can be considered helpful for setting one up. The most simple way to create a navigation box is to:

  • create a new page with an appropriate name. For example, for the Newsagent documentation there is a Newsagent/Navbox page to contain the navigation box for the Newsagent documentation.
  • on the new page, set up the navigation box you'd like to use. This can be a little daunting, but really most of the options can be ignored in general use, you only really need to bother with the name, title, a special-voodoo-'navbar' setting, and one or more lots of groupN and listN lines. For example, here's the navigation box for Newsagent:
{{Navbox
<!-- name should be the name of the page containing your navbox. The lead ':' is explained below. --> 
| name   = :Newsagent/Navbox
<!-- Title is shown in the Navbox title bar. This is a link to the 'start' of the Newsagent docs -->
| title  = [[Newsagent|Newsagent Documentation]]
<!-- This suppresses some links you don't need. You generally always want to set this -->
| navbar = plain

<!-- This is the first line of the box (hence the '1' after group and list). Group is optional, and
     the value can be a link instead of plain text if you want. The list contains links to the pages
     in the documentation, {{dot}} is a handy template to insert dots between links for readability -->
| group1 = User docs
| list1  = [[Newsagent|Overview]] {{dot}} [[Newsagent/Login|Logging in]] {{dot}} [[Newsagent/Compose|Composing Articles]] ([[Newsagent/Quickstart|Quickstart]]) {{dot}} [[Newsagent/Feeds|Feeds and Visibility]] {{dot}} [[Newsagent/ArticleList|Listing Articles]] {{dot}} [[Newsagent/Editing|Editing Articles]] {{dot}} [[Newsagent/Logout|Logout]]

<!-- another example, with fewer links. You can have up to 20 lots of group/list lines. -->
| group2 = Tech docs
| list2  = [[Newsagent/Information|Advanced/Upcoming features]] {{dot}} [[Newsagent/Tech|Technical]]
}}
  • When you save the page, you should see that it contains something vaguely along the lines of:

  • You can now include this at any point in any page you need by including it as a template. For example, if you created your navbox on a page called My Documentation/Navbox you would include it in pages using {{:My Documentation/Navbox}}

The examples here have an odd ":" at the beginning of the template names, and the reason for that is tied into how MediaWiki handles templates. Normally, when you include a template with something like {{AmazingTemplate}}, and you don't specify an existing namespace for the page, MediaWiki will take the page name between the pairs of curly brackets and prepend it with the Template: namespace, and then take the contents of Template:AmazingTemplate and insert it into your page in the place of {{AmazingTemplate}}. If you want to use a page that is not in the Template: namespace (or another valid namespace) as a template, you need to tell MediaWiki that it should not prepend the page name you specify in the curly brackets with Template:. That's what the ":" does; it allows you to use a template marker like {{:My Documentation/Navbox}} and MediaWiki will see the leading ":" and know that it needs to use My Documentation/Navbox as the template rather than Template:My Documentation/Navbox. The Templates documentation has more about this.

The Infobox templates

{{Infobox}} is another flexible and powerful template, designed to allow boxes of information to be positioned at the right side of a page as an "at a glance" summary of the subject of the page. The Infobox template itself is not generally intended to be used directly, rather you are expected to use one of the simpler, predefined sub-templates. Currently, two such templates are available:

  • {{Infobox software}} A simplified infobox designed to summarise information about software packages.
  • {{Infobox user}} a 'user-data' information box, mostly useful for user pages but may be useful elsewhere.

Additional generic templates can be created as needed, if you find yourself needing a specific sort of infobox, contact support.

Authors

  • gravatar Mbasscp2 [userbureaucratcomp23420editorhandbook-editinterface-adminlabhelpstaff-editsysopPHRhYmxlIGNsYXNzPSJ0d3BvcHVwIj48dHI+PHRkIGNsYXNzPSJ0d3BvcHVwLWVudHJ5dGl0bGUiPkdyb3Vwczo8L3RkPjx0ZD51c2VyPGJyIC8+YnVyZWF1Y3JhdDxiciAvPmNvbXAyMzQyMDxiciAvPmVkaXRvcjxiciAvPmhhbmRib29rLWVkaXQ8YnIgLz5pbnRlcmZhY2UtYWRtaW48YnIgLz5sYWJoZWxwPGJyIC8+c3RhZmYtZWRpdDxiciAvPnN5c29wPGJyIC8+PC90ZD48L3RyPjwvdGFibGU+]