Main > Wiki Discussion

Templates

(1/4) > >>

mahuti:
Thought this might be a useful note

While enhancing my wikifu, I came across this.

Creating, editing and using templates

You start a new template in the same way you would start a normal page. The only difference is that its title must start with Template:

(eg. Template:templatename)

Once you have made the template, you can add {{templatename}} to the pages you want to use it on. Every page using this template will get the same boilerplate text, each time a user visits it. When the template is updated, all pages containing the template tag will automatically be updated.
Alternatively, you can add {{subst:templatename}} to the pages you want to use the boilerplate text on. The system will fetch a one-time copy of the template text and substitute it into the page, in place of the template tag. If anyone edits the template afterwards, pages that used the subst: keyword will not be updated. Sometimes that's what you want.

If the template you want to edit looks like {{foo}}, you would go to Template:foo to edit it. To get there, type in the URL to your address bar, search for it, or make a link in the sandbox and click on it.
Once you are there, just click "edit" or "edit this page" and edit it in the same way you would any other page. You can add anything you would add to a normal page, including text, images and other templates. Please be aware that your edit might affect many pages, so be cautious.

Also use
{{Cleanup}} To insert standard "clean this up" boilerplate text.

JoyMonkey:
I'm still not sure of what these templates are used for.
Could it be used to modify a pages overall flow, so the table of contents could be shown on the right instead of left, or running alongside the main body of text?

mahuti:
Basically just adding an initial set of text to a page. And any time that template text is updated, it updates the templated page. Limited functionality, but it can be useful. The subst:templatename might be more helpful because it would allow you to create a standard starting point for various types of pages. Like if someone were to make some sort of obnoxious processor / motherboard / mame comparison at some point and you wanted to have a standard set of information presented, like

Processor:
Ram Amount:
Motherboard:
Video Card: 
etc.. and have that information be presented consistently. The subst:templatename would come in handy because with that use, the data on the page doesn't get updated, the template just gets used the one time and then becomes an editable part of the page.

mahuti:
Oh, and the templates can also add an automatic link to the proper category page. You could just as easily add the category:categoryname to the bottom of the page every time, but updating a category on a template would edit the category for all of those templated pages as well in one go. 

sirwoogie:
I created the Template:Cleanup a few days ago. I haven't added anymore. Like the pages, I'm open for anybody to put templates up there as they see fit. I'll eventually have a bot reap anything that isn't used.

Navigation

[0] Message Index

[#] Next page

Go to full version