Help:Template

From neilgaiman.info

Jump to: navigation, search

(NOTE: What MediaWiki calls templates we call modules so as not to confuse them with the template module. This help page deals with the template module.)


Contents

Overview

Templates are used to insert data into pages in an XML format. The XML will be automagically converted to XHTML and styled with a CSS stylesheet. This frees the user from having to make any design/layout decisions, as well as enforcing a level of uniformity in the entries.


List of templates

You may consult neilgaiman.info:Templates for a list of templates with example data.


Use

You may manually enter one of the template schemas linked above into an edit window. So that you won't have to, the template tool is provided.

When editing a page, the template tool appears at the top above the toolbar.


Browsers without Javascript

The template tool is designed to degrade gracefully in browsers which are not javascript-enabled. For these browsers, the tool is very simple.

Select the relevant template from the pull-down menu. Clicking the insert button will cause the edit page to reload with the blank template at the bottom of the page.

NOTE: Only the previously saved text in the edit window will be present after the page reloads. If you have made changes to the page, save it first and then return to the edit page before inserting a template.

Javascript-enabled Browsers

Browsers with javascript enabled have many further options when using the template tool.

Select the relevant template from the pull-down menu. Clicking the insert button will cause a blank template of that type to be inserted into the edit window at the position of the cursor.

If you select a template for which data can be automatically loaded into the template, the template tool box will expand to include two new fields: Title and, depending on the template, Author, Artist, or Director. You may fill either or both of these in, but you must fill at least one in.

Clicking the lookup button will cause a lookup to be performed through amazon.com. The results, when they are returned, will appear within the template tool box.

Select the radio button next to the result that corresponds to the entry you wish to make and click the insert templated entry. As is the case with the basic insert button, the template will be inserted into the edit window at the position of the cursor.

HINT: You may insert multiple templated entries into a single page. When doing so, the last title and author, director, or artist will be automatically left in those fields.

This means that you can, for example:

  1. look up a book
  2. insert the templated book entry
  3. change the template type to edition (the name and author of the book will be present in the fields already)
  4. click the lookup button to pull up the same output of books as in the first step
  5. select a different version of the book
  6. place your cursor at the start of the </editions> line
  7. click the insert templated entry button

The new selection will be added to the record as a new edition. Repeat steps 5-7 for each of the editions of the book. (There is no need to repeat steps 3 or 4.)

A screencast showing how to do this may be found here.

Personal tools