wiki.lolcow.city:A guide on templates and modules: Difference between revisions

Formatting. Feel free to edit
imported>DaWhiteLouise
imported>KanamoriKamper
(Formatting. Feel free to edit)
Line 7: Line 7:
There are also special kinds of Modules that can affect the whole site (such as Common.css and Common.js) that wiki admins can use to change things like style of the stie or to display site-wide messages.
There are also special kinds of Modules that can affect the whole site (such as Common.css and Common.js) that wiki admins can use to change things like style of the stie or to display site-wide messages.


===Embedding Templates===
== Embedding Templates ==
You can embed template into articles by using two curly brackets <code><nowiki>{{example}}</nowiki></code> or clicking on "insert" in your toolbar and then "template"  in the dropdown menu.
You can embed template into articles by using two curly brackets <code><nowiki>{{example}}</nowiki></code> or clicking on "insert" in your toolbar and then "template"  in the dropdown menu.
[[File:Toolbox image.png|thumb|center]]Depending on the template, you may also need to input some parameter info, especially in the case of infoboxes.  
[[File:Toolbox image.png|thumb|center]]Depending on the template, you may also need to input some parameter info, especially in the case of infoboxes.  


===Embedding Modules===
== Embedding Modules ==
For modules, embedding them directly in articles is is <u>highly discouraged</u> for many reasons and it's recommended you embed them into templates and use the templates in articles. It can be overly complex, difficult to maintain, slow page rendering, and can hurt consistency in articles due to the Module form of templatedata being inaccessible.
For modules, embedding them directly in articles is is <u>highly discouraged</u> for many reasons and it's recommended you embed them into templates and use the templates in articles. It can be overly complex, difficult to maintain, slow page rendering, and can hurt consistency in articles due to the Module form of templatedata being inaccessible.


You can embed modules into (preferably) templates using the <code><nowiki>{{#invoke:ModuleName|FunctionName|parameter1...}}</nowiki></code> command. You can only embed manually through source editing.
You can embed modules into (preferably) templates using the <code><nowiki>{{#invoke:ModuleName|FunctionName|parameter1...}}</nowiki></code> command. You can only embed manually through source editing.


===Creating a Template or Module===
== Creating a Template or Module ==
You can create a template/module page the exact same way as a page with one exception, that being that you need to put either Template: or Module: before the name of your template/module.
You can create a template/module page the exact same way as a page with one exception, that being that you need to put either Template: or Module: before the name of your template/module.