LXF Wiki:Templates

From LXF Wiki

Templates are truly wonderful time-savers when putting similar stuff on lots of Wiki pages.

They are an example of transclusion - the gentle art of dynamically including content from one page in another, thereby rendering HTML, XML, CSS, javascript, VBScript (Boo! Hiss!) and all those server-side PHP/JSP/ASP etc. things just unbelievably archaic.

Table of contents

About templates

Boilerplate templates

A boilerplate template is just a small page with a fragment of stuff you can drop into any other page like this:

{{Template:stub}}

Which adds this to your page:

This Linux-related article is a stub. You can help LXFWiki by expanding it (http://www.linuxformat.co.uk/wiki/index.php?title=LXF_Wiki:Templates&action=edit).

Templates with variables

You can add variables to a template to customise the content, like this simple template called Template:highlight:

<span style="padding: 1px 2px 1px 2px; background-color:{{{1}}};">{{{2}}}</span>

Which you add to a page like this:

{{highlight|yellow|it highlights text}}

Through the magic of transclusion, when you view the page the wiki merges the two fragments of code and delivers this to your browser:

<span style="padding: 1px 2px 1px 2px; background-color:yellow;">it highlights text</span>

so you get to see this: it highlights text wherever you put it.

Templates on LXF Wiki

The MediaWiki version used by LXF Wiki is almost as archaic as the rest of the web, and this has consequences for its templates.

Limitations

If you are familiar with today's MediaWiki, you will find this site a bit limited:

  • <noinclude> and <includeonly> not supported.
  • No variable names - they must be numbered in sequence.
  • Templates can't be categorised (no <noinclude>, y'see). Or at least, if you add a category to a template (such as Template:Stub), it will add the category to every page invoking the template and this cannot be stopped.

List of templates

If you create a template on LXF Wiki or stumble across one, please add it to this list. This is because (unlike the modern wikipedia) templates can't be categorised and, for some unhelpful reason, there is no Special:Templates page.

Boilerplate templates

This Linux-related article is a stub. You can help LXFWiki by expanding it (http://www.linuxformat.co.uk/wiki/index.php?title=LXF_Wiki:Templates&action=edit).
This page has a broken link to an image. Please fix it if you can, or find an alternative

Customisable templates