v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Create new FAQ category

From Dwarf Fortress Wiki
Revision as of 00:43, 1 August 2008 by Juckto (talk | contribs) (Updated)
Jump to navigation Jump to search

Template

A template is a wiki tool that acts kinda like a global "copy-paste" function. If you create a template page you can use it anywhere else on the wiki by simply using the {{ }} code.


For example, if I created the page
http://dwarf.lendemaindeveille.com/index.php/Template:Magma_FAQ
I could insert it into any page by typing
{{Magma FAQ}}


I took full advantage of this to relate FAQ questions from the same category to each other. For obvious reasons, the code in each template is similiar, and below I provide the "blank slate" version which you can copy and alter accordingly.

Note: The only way to create a new template, that I know of, is to type it into the address bar (with the little Template: bit to differentiate from a normal page). It will, of course, come up as "No pages match" and you can edit it from there.


Notation

I consider it to be important to have a consistent naming system. All the template pages I created were of the form Category_FAQ (as opposed to "FAQ_Category").


For example,
http://dwarf.lendemaindeveille.com/index.php/Magma_FAQ
Don't forget the underscore! (It becomes a 'space')


Template Code

This is the table I used in the templates, and the invisible comments I included to help anyone who wanted to add new questions to the template at a later date. Copy this entire section into your template page, and replace everything that is shown here in bold (note, some is off to the right).

On that note, I'm sorry about breaking the width on this page, but it has to be done otherwise this code breaks (badly) when you copy-paste it. This code is for the Wood FAQ, but you can easily change the names to reflect your new category.

 <!---To add a new question, COPY the following two lines. ALL OF THEM. Yes I *DO* mean the |- stuff TOO. And PASTE them BETWEEN the ###### comments lower on this page.

|-
| [[Your question exactly as you want it to be read by others]]

LEAVE THE QUESTION MARK OUT, as this wiki engine doesn't cope well with creating %3F pages.
--->

<center>
{| class="collapsible collapsed infobox" style="background-color: #f9f9f9; border: 1px solid #aaa; font-size: 90%; margin: 1em 0em 0em; padding: 2px; text-align: center; width: 60%;"
! colspan="2" style="border: 1px solid #aaa; font-weight:bold; background-color: #ccf; padding-left: 1em; padding-right: 1em;" | '''Wood FAQ'''
|-
| [[Do I really need wood|Do I really need wood?]]
|-
| [[Wood|Where can I get wood?]]
|-
| [[Tower-cap|How do I build an underground tree farm?]]
<!--- ########### Insert new questions below this line ########### --->

<!--- ########### Insert any new questions above this line ########### --->
|-
|height="10"| 
|-
| {{Edit|Template:Wood_FAQ|Add a question to the Wood FAQ}}
|-
| [[Frequently Asked Questions|Back to the Main FAQ]]
|}

<includeonly>[[Category:FAQ - Wood]]]</includeonly>
<noinclude>[[Category:Templates]]</noinclude>


I want to stress that it is important that you get that category's address correct - that line is a web address that will take users to your template's editing options.
It includes Javascript - or whatever it is (I'm no IT expert) - and so it's important you don't screw it up.

An example of what the finished template code should look like

Answers

Don't forget to put the template in the answer page! Otherwise it renders the entire exercise pointless!


For example, if I was answering a question in the Magma section, I would add

{{Magma FAQ}}

at the bottom of my answer.