![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|
|||||||
|
|
Help:TemplateFrom BRWiki(Redirected from BRWiki:Template)
"Template:" vs Local Templates
You may already have seen that some pages use Wait, what did I just say?
For site-wide templates, it makes sense to put them in the "Template:" namespace where everyone can find them, but for something that you're only using in a few pages, it makes much more sense to just put it in e.g. "MyPage/TheTemplate", and pull it in with
You will have to use your own judgement for what's right for your template. Here's a few instructive examples though: Templates that belong in "Template:"
Templates that perhaps didn't belong in "Template:"
Naming your templateThis depends on where your template gets placed, really. And how commonly used you think it's going to be.
Explaining what your template doesIt's very helpful to others (or, heck, yourself half a year from now!) to explain what your template actually does and why it exists. It's easy to put this information in the template without it pestering pages where it's included:
... where "X" and "Z" certainly can be left out if it's obvious, and "Y" might be "globally" or "all pages dealing with ...". It doesn't even have to follow any particular format, really; just a quick note about the template helps! This becomes even more important when your template uses parameters. Other people really appreciate it when you explain what order to input things.
Templates have Talk pages too!If there's more you'd like to say about your template than you care to explain between <noinclude> tags, templates do have talk pages just like any other page! It might be a good idea to mention that there's info in the talk page between your <noinclude> tags though; most people don't go looking for talks on templates. ;-)
Tips and tricks
Categories in templatesIf you put a category in a template, all pages that use the template will suddenly end up in that category. Well, semi-suddenly anyway; the page needs to be edited once (just add a blank line or a space) before they're actually moved. However, if you just go ahead and put in the category tag, your template will end up in the category too, which is maybe not what you intended. Use this:
Template parametersThis is actually a fairly huge topic; we'll try to cut it short.
Equal signs in parameter valuesSince equal signs, "=", are part of how parameter values are supplied, they're a little bit troublesome. You can't supply equal signs to numbered parameters at all. However, you can supply them to named parameters:
Templates can use templates!When your templates are getting big, chances are you want to re-use something from one template in another template.
There's also other reasons why you may want to use sub-templates. See e.g. {{Delete}} and {{Delete/Content}}. Pulling in "Delete" automatically marks the page for deletion, but BRWiki:Delete also wants to show what it looks like without getting itself marked for deletion, so it just pulls in "Delete/Content".
Splitting templates into a /Begin and /End
Template parameters can't contain just anything. They're pretty aggressive about HTML tags, and trying to insert "{" or "}" or "=" is bordering on painful. So for templates where you know you'll have lots of content, or quirky content, it makes more sense to split them up into a "Begin" and "End" template, e.g. "MyTemplate/Begin", "MyTemplate/End".
Categorize your templates!It helps other editors (and probably yourself, too!) if you categorize your templates themselves. Perhaps not so much for "Template:" templates, but definitely for local templates! Pages that use a local template will likely share one or more common categories, so making a "Your Category/Templates" and putting the templates there helps other editors find them easily!
Automatic subtemplate selectionThere is a number of built-in variables that are very useful for templates. One such is {{PAGENAME}}, which for this page is "Template". So all base zone pages could for instance use a template that pulls in ":{{PAGENAME}}/Boss list", and links to "{{PAGENAME}}/Loot list". But attempting to use that template inside one of the subpages would break horribly.
Other resources
Pages with lots of templates not updatingWhen a page pulls in lots of templates, it won't always update when a template changes. There are two ways to force a refresh:
Is anything on this page unclear? Or is there something you'd like to know more about? - Drop a line in the Talk page! It's on my watchlist. --Mikk 05:25, 26 May 2006 (EDT) |