Latest Neocron News and Information
- New test server patch #564 has been released to Vedeena
Difference between revisions of "Neocron Wiki:Templates"
m |
(Remove tipbox) |
||
(9 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | '' | + | <table width="100%"> |
+ | <tr> | ||
+ | <td width="70%">[[Image:Wiki-article.png|right|400px]]</td> | ||
+ | <td width="30%">{{Infobox|<center>[[Image:New.png|50px]]</center> | ||
+ | ---- | ||
+ | For a list of all current templates go [[Project:List of templates|here]]}}</td> | ||
+ | </tr> | ||
+ | </table> | ||
+ | |||
+ | = Templates = | ||
+ | |||
+ | {{Infoline|''What are they used for, when should they be used, who should use them..etc.''}} | ||
+ | |||
+ | A template is basically a [[Project:Transclusion|transcluded]] page, it can be purely HTML code, or can be purely text, or a mixture of them both. Most templates within the [[Project:About|Neocron Wiki]] are coded in HTML and perform specific functions. For example we have templates for the {{[[Template:Deletion|Deletion]]}} and movement {{[[Template:Move|Move]]}} of pages. | ||
+ | |||
+ | Templates are very easy to make, and can be used in a very powerful way once they have been designed correctly and for the correct reasons. You will find lots of templates all over the site, infact most of the front page is templated so only individual sections need to be edited to easily change the front page. | ||
+ | |||
+ | ==Adding a Template== | ||
+ | |||
+ | {{Infoline|''How to add a template, where to add the template, etc.''}} | ||
+ | |||
+ | Adding a template is easy, you need to find the name of the template from [[Project:List of templates|here]] and then add the name to the page with curly braces around the name, for example {{[[Template:Deletion|Deletion]]}} will add the deletion template to the page, and will add the page to the deletion category. | ||
+ | |||
+ | Ideally there are certain templates we only expect the [[Project:Administrators|admins]] to add to pages, this is explained further within [[Project:List of templates|here]]. Other templates should be used freely by everyone who uses the site, for example the {{[[Template:npcbox|npcbox]]}} should be used on every page that describes an NPC, both on combat NPCs and non Combat NPCs. {{[[Template:Tipline|Tipline]]}} should be used in all of the mission guides to allow tips for the mission to be placed in easily readable boxouts. | ||
+ | |||
+ | ==Editing a Template== | ||
+ | |||
+ | {{Infoline|''How/why should a template be edited?''}} | ||
+ | |||
+ | It should be often that the often used templates should be edited, most of those templates should be locked to stop any accidental (or malicious) change of the template, as the templates are used on a huge proportion of the site, very large vandalism could occur within a short period of time. For this reason if you feel that the template needs updating or change, then it is recommended that you add to the talk page, and discuss what needs changing, if no one responds within a week then contact an [[Project:Administrators|admin]] for further help. | ||
+ | |||
+ | ==Creating a new Template== | ||
+ | |||
+ | {{Infoline|''Guide to creating a new Template''}} | ||
+ | |||
+ | Creating a new template should be very easy if you have a modicum of knowledge of the HTML language. Most templates are made using simple HTML commands, and an example can be seen below. The following points should be considered before embarking to make your own template. | ||
+ | |||
+ | * Is there a real need for the new template? (Always ask yourself this - we dont want lots of new useless templates!) | ||
+ | * Think up a nice simple name to describe the template | ||
+ | * Go to the page Template:<Name> (Where <Name> is the template name) | ||
+ | * This will then make a new page for the template, this is where you can start making the template | ||
+ | * Design the template simply using HTML and CSS commands, a list of inbuilt CSS commands within the NC Wiki skin is below. | ||
+ | * If you are making the template add each page to a new category then include the category command within <nowiki><includeonly></includeonly></nowiki> tags. This then makes the category only appear on each page that it is transcluded too and not the page it has been written on. | ||
+ | * It is possible to add extra arguments to the template, for example {{[[Template:copyright|copyright]]|year=2002|web=http://wiki.techhaven.org|company=THN|name=Delphi|user=<name>}} will add all the information to the template in the order it was made - check the template for more information on that. | ||
+ | * When the code has been included sometimes it is worth including a section on how to use the template - for example look at {{[[Template:npcbox|npcbox]]}} where another page has been transcluded onto the template page explaining how the template should be used. | ||
+ | |||
+ | ===Included CSS commands=== | ||
+ | |||
+ | {{Infoline|''Template based CSS commands''}} | ||
+ | |||
+ | * Div styles: | ||
+ | :: tempbox-purple | ||
+ | :: tempbox-green | ||
+ | :: tempbox-blue | ||
+ | :: tempbox-red | ||
+ | :: tempbox-yellow | ||
+ | |||
+ | ==Example Templates== | ||
+ | |||
+ | {{Infoline|''An example of the code used to make the <nowiki>{{Move}}</nowiki> template''}} | ||
+ | |||
+ | <pre> | ||
+ | <center> | ||
+ | <div class="tempbox-purple"> | ||
+ | <table width="98%" align="center"> | ||
+ | <tr> | ||
+ | <td width="48px" rowspan="3">[[Image:Icon-move.png|left|48px|Move]] </td> | ||
+ | <td>It has been suggested that this article should be moved to '''{{{1}}}''' </td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td>{{hspc}}Please see the [[{{PAGENAME}}:Discussion|discussion]] here for more information</td> | ||
+ | </tr> | ||
+ | </table> | ||
+ | </div> | ||
+ | <br> | ||
+ | </center> | ||
+ | |||
+ | <includeonly>[[Category:candidates_for_moving|{{PAGENAME}}]]</includeonly> | ||
+ | </pre> | ||
+ | |||
+ | When the template is transcluded onto the page using <nowiki>{{Move|Pagename}}</nowiki> then this is rendered: | ||
+ | |||
+ | {{Move|Pagename}} |
Latest revision as of 22:16, 28 July 2020
|
Templates
A template is basically a transcluded page, it can be purely HTML code, or can be purely text, or a mixture of them both. Most templates within the Neocron Wiki are coded in HTML and perform specific functions. For example we have templates for the {{Deletion}} and movement {{Move}} of pages.
Templates are very easy to make, and can be used in a very powerful way once they have been designed correctly and for the correct reasons. You will find lots of templates all over the site, infact most of the front page is templated so only individual sections need to be edited to easily change the front page.
Adding a Template
Adding a template is easy, you need to find the name of the template from here and then add the name to the page with curly braces around the name, for example {{Deletion}} will add the deletion template to the page, and will add the page to the deletion category.
Ideally there are certain templates we only expect the admins to add to pages, this is explained further within here. Other templates should be used freely by everyone who uses the site, for example the {{npcbox}} should be used on every page that describes an NPC, both on combat NPCs and non Combat NPCs. {{Tipline}} should be used in all of the mission guides to allow tips for the mission to be placed in easily readable boxouts.
Editing a Template
It should be often that the often used templates should be edited, most of those templates should be locked to stop any accidental (or malicious) change of the template, as the templates are used on a huge proportion of the site, very large vandalism could occur within a short period of time. For this reason if you feel that the template needs updating or change, then it is recommended that you add to the talk page, and discuss what needs changing, if no one responds within a week then contact an admin for further help.
Creating a new Template
Creating a new template should be very easy if you have a modicum of knowledge of the HTML language. Most templates are made using simple HTML commands, and an example can be seen below. The following points should be considered before embarking to make your own template.
- Is there a real need for the new template? (Always ask yourself this - we dont want lots of new useless templates!)
- Think up a nice simple name to describe the template
- Go to the page Template:<Name> (Where <Name> is the template name)
- This will then make a new page for the template, this is where you can start making the template
- Design the template simply using HTML and CSS commands, a list of inbuilt CSS commands within the NC Wiki skin is below.
- If you are making the template add each page to a new category then include the category command within <includeonly></includeonly> tags. This then makes the category only appear on each page that it is transcluded too and not the page it has been written on.
- It is possible to add extra arguments to the template, for example {{copyright|year=2002|web=http://wiki.techhaven.org%7Ccompany=THN%7Cname=Delphi%7Cuser=<name>}} will add all the information to the template in the order it was made - check the template for more information on that.
- When the code has been included sometimes it is worth including a section on how to use the template - for example look at {{npcbox}} where another page has been transcluded onto the template page explaining how the template should be used.
Included CSS commands
- Div styles:
- tempbox-purple
- tempbox-green
- tempbox-blue
- tempbox-red
- tempbox-yellow
Example Templates
<center> <div class="tempbox-purple"> <table width="98%" align="center"> <tr> <td width="48px" rowspan="3">[[Image:Icon-move.png|left|48px|Move]] </td> <td>It has been suggested that this article should be moved to '''{{{1}}}''' </td> </tr> <tr> <td>{{hspc}}Please see the [[{{PAGENAME}}:Discussion|discussion]] here for more information</td> </tr> </table> </div> <br> </center> <includeonly>[[Category:candidates_for_moving|{{PAGENAME}}]]</includeonly>
When the template is transcluded onto the page using {{Move|Pagename}} then this is rendered:
It has been suggested that this article should be moved to Pagename | |
|