Tutorial:AdvancedTutorialPage1i

From WikiChem
Revision as of 04:10, 24 May 2011 by Walkerma (talk | contribs) (Expand)
Jump to: navigation, search
Wiki 3 bell image.jpg

OK, you've now mastered most of the routine parts of MediaWiki. What about using some bells and whistles?

The first of these is the parser function, which is a number or word surrounded by three curly brackets, such as {{{1}}}. With this feature, you can customize your template, by allowing you to input variables. Take a look at this example, which has the following code (excluding the category info) on the template page:

Birthday cake (fun).png
{{{Name}}} has a birthday on {{{Month}}} {{{Date}}}!

When you use this template on a page, the variables are named explicitly as Name, Month and Date. We can enter these parameters in any order, using the | symbol to separate them, thus:

{{Birthday|Name=Michael Jones|Date=12th|Month=June}} produces

Birthday cake (fun).png

Michael Jones has a birthday on June 12th!



You can also use unnamed parameters, in which case the variables must be entered in the standard order. In these cases, the template contains numerical parser functions {{{1}}}, {{{2}}}, etc.

These can quickly get quite ridiculous in the hands of a real expert - take a look at one of the most widely used templates on Wikipedia, the WPBannerMeta template.

Next page