Template Syntax

From WikiEducator
Jump to: navigation, search



The syntax you use to include an iDevice template in your content is quite simple. You just surround the name of the template in curly braces like this:

{{Template_name}}

To include the Objectives template in your content, for example, you would write:

{{Objectives}}

Rich Editor

To add a template using the rich editor, you will need to be in edit mode (click the edit tab at the top of the page). Once you are in the edit mode, click on the template button in the toolbar above the editing area to insert a template as shown in the figure below.

Screenshot of the rich text editor toolbar with the template button highlighted.
Template properties dialog with {{Objectives}} entered in the text area.

After clicking on the template button you should be presented with a dialog box entitled, Template Properties. The text area in the dialog box is where you will enter the template syntax that was mentioned earlier. You can either type in the template syntax or copy and paste it from another location. In this example, {{Objectives}} has been typed in the dialog box's text area.

Clicking ok at the bottom of the dialog box will add {{T}} to your text area where the cursor was prior to opening the Template Properties dialog box.


Preview, the template insertion by clicking the Show Preview button at the bottom of the edit area (or use the ctrl-shift-p key combination). A preview of the objectives template would appear like this:


Icon objectives.jpg
Objectives
{{{1}}}


(If you see {{{1}}} don't worry. It will disappear when you add some content.)


Wikitext

An alternative (and possibly simpler) method to insert a template is to switch from the rich editor to wikitext mode. You can do this by clicking the Wikitext button on the rich text editor toolbar as shown in the figure below.

Clicking on the wikitext button will change the text area to wikitext editing mode.

You should see a change in the format of your page. There may be some symbols that you are not familiar with. However, this is a good way to learn what the toolbar buttons are doing.

At this point we can type {{Objectives}} or cut and paste it into the editable area. It is now time to preview our work by clicking on the Show preview button at the bottom of the edit area.

Like the previous method you would see the following:



Icon objectives.jpg
Objectives
{{{1}}}


in the preview area.

Adding content to your template

A right click on the {{T}} causes this dialog to appear. Select Template Properties to edit the template.

You can include almost any wiki text you like inside your template. In this section we will focus on using the rich editor to edit a template that already exists. To edit the template we can right-click on the {{T}} and select Template Properties as shown in the figure to the right (or click the template button on the toolbar that was used to create the original template).



Icon key points.gif
Key point
You will not be able to use the rich text editor toolbar when adding text to the content of a template. Therefore it is always a good idea to have a copy of the wikipedia cheatsheet near by.



Adding content to a template begins by typing a pipe "|" (shift then \ on most keyboards) right after the template name, then the wiki text like this:

{{Objectives|
My objectives will go here:
* one
* two
}}

Don't forget to close it all off with double curly-braces. Clicking ok will bring you back to the text area with {{T}} representing your template. Previewing your additions will result in an iDevice like this:



Icon objectives.jpg
Objectives

My objectives will go here:

  • one
  • two


Icon present.gif
Tip: When an iDevice immediately follows a section heading, the heading text may overflow into the display of the idevice. This is easily corrected by inserting the syntax for an extra line or carriage return when the editor is in wikitext mode. However it is a little more complicated when using the rich editor.

To adjust the margins following a heading, insert

|TopMargin=10px

after your content in the idevice, for example:

 {Objectives|
 My objectives will go here:
 * one
 * two
 |TopMargin=10px}}.

See detailed instructions about intervening when an iDevice directly follows a section




Icon activity.jpg
Activity

Try adding a Web Resources template into your User page and add some of your favourite links into it as content.

The Web Resources template can be inserted like this: {{Web_Resources|}}




Icon present.gif
Tip: Keeping track of templates in the rich editor can become confusing when there are several templates in a page. We recommend frequently viewing your page in wikitext mode so you become familiar with wikitext and where each template is located.