Help:MediaWiki basics/Advanced training
This is advanced training material for MediaWiki. If you still have problems after reviewing and practicing the material found here and in the beginner and intermediate guides, you can request help on this discussion page. |
Advanced formatting in MediaWiki
Note: When opening links from wiki pages, right-click a link and choose to open it in a new tab. This should make navigating your way through the wiki less complex.
Templates
In the previous training section, we briefly touched on the template. Here's the example we used in that section:
Chords being played on an accordion
|
|
Problems playing this file? See media help. |
{{Listen | filename = Accordion chords-01.ogg | title = Accordion chords | description = Chords being played on an accordion | pos = left }}
As we stated, that code is used in relation to the Listen template. A template typically contains repetitive material that might need to show up on any number of articles or pages. The most common method of inclusion is called transclusion, where the wikitext of the target page contains a reference to the template using the {{Template name}}
syntax. In this case, it's {{Listen}}
, and it includes some modifiable parameters.
Now let's get back to that box with text and a big blue "i" at the top. We call that an "infobox." That's created using the template "ombox". Templates are held in their own special namespace on the wiki. Open the previously mentioned ombox link in a new tab to learn more about this template. As you review it, you'll notice the parameters that can be associated with this template:
{{ombox | type = speedy / delete / content / style / notice / move / protection | image = none / [[Image:Some image.svg|40px]] | imageright = [[Image:Some image.svg|40px]] | style = CSS values | textstyle = CSS values | text = The message body text. | small = {{{small|}}} / yes | smallimage = none / [[Image:Some image.svg|30px]] | smallimageright = none / [[Image:Some image.svg|30px]] | smalltext = A shorter message body text. }}
A proper template page will also include documentation on how to use it, so don't feel too overwhelmed. For now, know template formatting is distinct because placing a template in another page involves placing two opening braces in front (like this: {{ ), the name of the template, the desired parameters associated with it, and finally two closing braces in the back (like this: }} ), just as we've seen in the above examples.
Here are some internal links to pages on this wiki that utilize a variety of different templates. Let's open each page in a new tab and choose the "edit" option to see the code. Then, let's identify all the templates used in those pages:
- LIMS vendor
- LIMSWiki:Vendor page
- 2nd Sight Solutions
- National Cancer Institute
- LIMSWiki:Product page
After looking in the code for curly braces, we find...
- Item one uses: Template:Ombox; Template:Cite web
- Item two uses: Template:Infobox company; Template:Ombox
- Item three uses: Template:Infobox company; Template:Ombox productfeature; Template:Databox LIMSfeature; Template:Cite web
- Item four uses: Template:Infobox government agency; Template:Cite news; Template:Cite web; Template:Ombox productfeature; Template:Databox LIMSfeature
- Item five uses: Template:Infobox laboratory equipment; Template:Ombox; Template:Infobox software; Template:Start date; Template:Start date and age
Notice the wide variety of templates already in use. Looking at a complete list of templates perhaps makes the topic even more daunting. Don't be afraid; templates have very practical uses and make information presentation more standardized and rapid. As for determining what the most-used templates are on this wiki... that's a more difficult task. However, the sampling above should give you an idea that ombox, citation, infobox, and databox templates are used often in the wiki.
For more on templates, consult the relevant help section or the MediaWiki handbook for more information.
One final note: honestly, the type of template you're most likely to use on the wiki shouldn't surprise you. Of course, it's the citation template.
Citations
To begin using citations, it's easy to start with a copy/paste of existing citation code. Inline citations are added directly after a piece of information or quote in a body of wiki text.
You'll want to use this page as your initial guide: LIMSWiki:Citation guidelines
It details the citation code you'll use on probably 95 percent of the references you make: Cite web, Cite book, and Cite journal
You can copy code from there, paste it into your edit, and then edit the values of the fields. That page also has links to the original templates in case you need additional attributes not listed in the examples.
Also, it's imperative to include a references section on any page that includes inline citations. Otherwise, pages won't show up properly. You do that by placing the following code:
==References== <references />