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.

Difference between revisions of "Create new FAQ category"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
(New page: 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...)
 
m (unversioned)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
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.
 
 
[[User:Juckto|Juckto]] 20:56, 26 November 2007 (EST)
 
 
 
__TOC__
 
 
 
 
=Template=
 
=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 <nowiki>{{ }}</nowiki> code.  
 
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 <nowiki>{{ }}</nowiki> code.  
Line 32: Line 24:
 
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 <u>everything</u> that is shown here in bold (note, some is off to the right).
 
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 <u>everything</u> 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.
+
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.
  <nowiki> <!---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.
+
  <nowiki> <!---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.
The 2 lines should be:
 
  
|-
+
|-
| [[Your question exactly as you want it to be read by others]]
+
| [[Your question exactly as you want it to be read by others]]
  
Go ahead and scroll down now.--->
+
LEAVE THE QUESTION MARK OUT, as this wiki engine doesn't cope well with creating %3F pages.
 +
--->
  
{| align=center style="width: 80%; background: #DEDEDE; border: 1px solid #999; border-left-color:#CDCDCD; border-top-color:#CDCDCD; text-align: center"
+
<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" | '''</nowiki> <b>(Insert your category title here)</b> <nowiki> FAQ'''
+
{| 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'''
| [[</nowiki><b> (Your first question) </b><nowiki>]]
+
|-
|-
+
| [[Do I really need wood|Do I really need wood?]]
| [[</nowiki><b> (Your second question) </b><nowiki>]]
+
|-
|-
+
| [[Wood|Where can I get wood?]]
| [[</nowiki><b> (Etcetera) </b><nowiki>]]
+
|-
<!--- ########### Insert any new questions above this line ########### --->
+
| [[Tower-cap|How do I build an underground tree farm?]]
|-
+
<!--- ########### Insert new questions below this line ########### --->
|height="10"|  
+
 
|-
+
<!--- ########### Insert any new questions above this line ########### --->
| [http://dwarf.lendemaindeveille.com/index.php?title=Template:</nowiki><b>(Insert the category's <u>address</u> here - eg Magma_FAQ)</b><nowiki>&action=edit Add a question to the </nowiki><b>(Insert your category title here)</b><nowiki> FAQ]
+
|-
|}
+
|height="10"|  
{| align=center
+
|-
|<small>This template has yet to be coloured in with pretty colours</small>
+
| {{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>
  
[[Category:FAQ]]
+
</nowiki>
[[Category:FAQ - </nowiki>'''(Insert your category title here)'''<nowiki>]]</nowiki>
 
  
 
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. <br>It includes Javascript - or whatever it is (I'm no IT expert) - and so it's important you don't screw it up.
 
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. <br>It includes Javascript - or whatever it is (I'm no IT expert) - and so it's important you don't screw it up.
  
 
[http://dwarf.lendemaindeveille.com/index.php?title=Template:Magma_FAQ&action=edit An example of what the finished template code should look like]
 
[http://dwarf.lendemaindeveille.com/index.php?title=Template:Magma_FAQ&action=edit 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:
 
 
<nowiki><h5><font color=”white”></nowiki><b>(Title as you want it to appear in the TOC)</b><nowiki></font></h5>
 
{{</nowiki><b>(Name of your template)</b><nowiki>}}</nowiki>
 
 
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):
 
 
  <nowiki>{{</nowiki><b>(Name of your template)</b><nowiki>}}</nowiki>
 
 
<nowiki>[[Category:FAQ]]</nowiki>
 
 
  
 
=Answers=
 
=Answers=
Line 101: Line 69:
 
  <nowiki>{{Magma FAQ}}</nowiki>
 
  <nowiki>{{Magma FAQ}}</nowiki>
 
at the bottom of my answer.
 
at the bottom of my answer.
 +
 +
[[Category:Wiki]]
 +
{{unversioned}}

Latest revision as of 17:28, 21 July 2019

Template[edit]

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[edit]

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[edit]

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[edit]

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.