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
Jump to navigation Jump to search

I used a fairly complex system to set up the FAQ page; involving templates, tables, and invisible headers. So this page is me providing an explanation of how it all works together, and the basic code which you can copy-paste to create your own FAQ category.

Juckto 20:56, 26 November 2007 (EST)



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.

 <!---To add a new question you need to scroll down to the bottom of this page and edit in TWO lines of code in the indicated spot.
 The 2 lines should be:

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

 Go ahead and scroll down now.--->

 {| align=center style="width: 80%; background: #DEDEDE; border: 1px solid #999; border-left-color:#CDCDCD; border-top-color:#CDCDCD; text-align: center"
 |+ style="color: #fff; background: #bbb; border: 1px solid #999; border-left-color:#CDCDCD; border-top-color:#CDCDCD; padding: 0.2em 0.5em;  text-align: center" | ''' (Insert your category title here)  FAQ'''
 |-
 | [[ (Your first question) ]]
 |-
 | [[ (Your second question) ]]
 |-
 | [[ (Etcetera) ]]
 <!--- ########### Insert any new questions above this line ########### --->
 |-
 |height="10"| 
 |-
 | [http://dwarf.lendemaindeveille.com/index.php?title=Template:(Insert the category's address here - eg Magma_FAQ)&action=edit Add a question to the (Insert your category title here) FAQ]
 |}
{| align=center
|<small>This template has yet to be coloured in with pretty colours</small>
|}


  [[Category:FAQ - (Insert your category title here)]]

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

Invisible Headers

Now for the final bit, adding your new category into the FAQ page. Just add the following code into the FAQ page. When it came time to insert the templates into the overall FAQ page, I struck a problem. I wanted the page to have a Table of Contents (TOC), but there didn't seem much point in having them displayed throughout the page since every template was self-titled. Was there anyway I could supress them?


Invisible Headers Code

After a little fiddling around in a sandbox I came up the following solution:

<h5><font color=”white”>(Title as you want it to appear in the TOC)</font></h5>
{{(Name of your template)}}

It's not true invisibility, but makes the headers white, meaning they can't be seen on the white background. If you try highlighting the text on the FAQ, you will see them ;).


Sub-categories

To make your new category a sub-group of the overall FAQ category, simply click on the link at the bottom (it should be red), and copy the following code. Now your category is a sub-category of the FAQ category, and any new question added should be added to your category’s … category (doh).


Sub-category code

If you want to write an answer to somebody else’s posted question please try to keep the answer short and simple, and link to the in-depth explanations elsewhere in the wiki. Don't forget to include the template into your answer (copy the following code into your answer):

 {{(Name of your template)}}

[[Category:FAQ]]


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.