Template guide

From Wiki

Jump to: navigation, search

If you are looking for code to create a template, please see Template examples page.

Contents

Template concept example

Chris is working on several templates as administrator. Templates as standard features. For example the navigation box to the left could be a template. In edit mode, {{Template example}} is all that somebody needs to type to insert a template.

Some templates allow variables to be placed in them. It is also possible to use a template to create a template. See the group template notes below. A template can be in image, a table with text or a table with text and images.

Templates can be borrowed from another wiki (say wikipedia). However, these templates often use CSS code that is located in another file.

Chris understands the general concepts. But he is not very experienced in playing with CSS or Templates for that matter.

Help template

The help template is a relatively simple template that is shown to the right. Below is the code that forms this template. The "div class" formats are references to CSS code. Notice the internal links. Somebody can insert another line and link it to a new page.

<div class="sideblock right">
 <div class="header">[[Help:Contents|Help]]</div>
 <div class="content">
 * [[Help:Editing|Editing help]]
 * [[Help:Page features|WikiFON page features]]
 * [[Help:Style guide|Style guide]]
 *[[Guidelines for contributors|Guidelines for contributors]]
 * [[Documentation philosophy]]
 * [[Help:User settings|User settings]]
 </div>
 </div>

We could do a copy and paste of this code into Template:Help_story_ideas. Then change the internal links to Ideas _training, Ideas_job, Ideas_PCVs, Ideas_staff, Ideas_smells, Ideas_colors, Ideas_sounds and so forth.

Group template

{{{group}}}
[[Image:{{{image}}}|100px| ]]
{{{caption}}}
Group description: {{{Group description}}}
Service years: {{{Service years}}}
Number of volunteers : {{{Number of volunteers}}}
Trained at : {{{Trained at}}}
{{{footnotes}}}


It would be nice to have a standard box (template) on the right for every group. This box might contain a lot of information suggested by others. For example, the Group number, period of service, place of training, type of group, approximated number of PCVs. Group motto, brief note about service, Group Logo or some other requested feature might be included. It would be nice if the box was visually pleasing. Let me call this the "Infobox group" template (in the form of a table that looks like a box).

Now we have our box. We can assign some variables instead the actual text. For the non-programmers, this means we can tell the template what to use for a group number and the template then places it in the correct place. This is handy in making it look pretty and standardizing the way the information looks. An example of a blank (no variables assigned yet) Infobox Group is to the right, the {{{group}}} indicates where the Group number would go.

The top form does not have information added to it. Here is an example of what would need to be added to create the Info Box for Group XVI below.

 {{Infobox Group |class="infobox bordered" style="width: 20em; text-align: left;  font-size: 90%;"
 |-
 |colspan="2" style="text-align:center; font-size: large;" 
 |-
 |colspan="2" style="text-align:center;" 
 |-
 |group= Nigeria XVI
 |image= LOGO new crop.gif
 |caption= FON.org
 |Group description= Ag/RD
 |Service years= 1965-67
 |Number of volunteers= 60
 |Trained at = MSU & St. Croix
 |Motto = Guinness gives you power
 |footnotes= Arrived before 1st coup, left before Eastern Region evacuation .
 }}

Specific Group template

Nigeria group XVI

FON.org
Group description: Ag/RD
Service years: 1965-67
Number of volunteers : 60
Trained at : MSU & St. Croix
Arrived before 1st coup, left before Eastern Region evacuation .

Chris's thinking is that the code for a template that uses variables looks imposing because it takes up lots of lines for the variables. Typically this would be placed at the top of a group description page in edit mode. Much better to see something like {{Infobox Group XVI}} so contributors can get right to the content.

The Group IV, GroupXVI and etc templates would use the Group template. Thus we could change the color scheme in the Group template, and this would be reflected in every other template. We could also add a new data field, say "group motto" to the group template. If Group XVI wanted to add their motto, it would appear in the place determined by the group template. But if Group IV did not have a motto, it would not be see. Or in this case Group XVI added a motto but it was not an assigned variable in the Group template, so it was ignored.

Template ideas

  • The group template seems like a good idea. Need to create for each group.
  • A bio template. Might contain standard information about a person.
  • ToDo template
  • Request for help templates. An image.
    • Need help formatting
      • Need help to insert pictures
      • Need help with list format
      • Need editor assistance
    • Need help with content
      • Date
      • People
      • Language translation

CSS information

Cascading Style Sheets (CSS) is a text file that store information about formating in one place. This information is really like a short cut, script or macro. Rather than create code that says something like "create a box with a green line around it, text will be orange, in 18 Times Roman, bold, on a light yellow background", we merely type Style=Chrisbox.header. We put all the code in the CSS file.

Again, this is handy when FON members say this is difficult to read. Blue text on yellow and a dark red border would be better. Changing the style sheet, changes every time Chrisbox.header is used. We could add to the CSS file a new format called BoxFON.header.

Some CSS code can be complicated and so can it's use in a template.

Where is this information

In edithis.info wiki, the css file can be overridden by placing the CSS info in the page "Header" This is a protected, Admin edit only page.

Chris added sidegroupblock code to the header page. He copied this from MoodleDocs CSS info that was called sideblock.


See also MediaWiki:Common.css in wikipedia

Template examples a list of templates in a table

Personal tools