BIONICLEsector01:Help/Advanced Wiki-Coding
Advanced wiki-coding is wiki-coding which is usually more complex then normal Wiki-coding, and is mainly restricted to templates, major pages or userpages. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There are several protocols that are used on the web. Some examples are http, https, and ftp. There is in fact a protocol for email: mailto. To create an email link, simply use the same code as you would for an external link except with a mailto protocol. Warning: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The "#switch" function is a Wiki function which allows the coder to store multiple versions of a template in one go, and can then "switch" to these versions by inserting or changing various variables. In this tutorial, we will learn about how to use the #switch function through images. The beginning of a basic "#switch" function coding looks like the following:
For the purpose of the tutorial, we'll stick with the coding above as our base. In this tutorial, we'll make a "#switch" template with two images, named "Image 1" and "Image 2", with "Image 1" being the default image which will show up when the template is not used. To start, we add in "Image 1":
The "Image 1=" defines the name of the variable, and the content ("Image:Noimage.jpg") defines what will appear when the variable is activated. The pipe ("|"), as normal, ends the variable tag. We can now add in "Image 2" using the same method:
As seen above, the "Image 2" variable is located beneath the "Image 1" variable. This is not compulsory, but helps to prevent confusion in some cases. Now to finish off the template, we add in the final, "default" variable:
...which will set "Image 1" as the image which will appear when the template is not being used. There are also many other ways to manipulate this function and use it for a variety of purposes. For example, a variable can be named differently, and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MagicWords are small codes that turn into page-specific words, time-specific words, or BS01 specific words/numbers before the page is parsed, meaning they can be used for actual words or for switches, links, and images as well. MagicWords generally are in all capitals with two curly brackets on each side or in rare cases, two underscores on each side. They aren't confused with templates because the Wiki has the ability to tell the difference. Here is a list of common MagicWords:
To use a MagicWord with a switch, it is not necessary to add a capital 'E.' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The #expr function acts like a calculator, completing an equation and inserting the result before the page is parsed, meaning it can be used for links and switches like a MagicWord. All basic operators will work in an equation, including (but not limited to) +, -, /, *, and ^ as well as <, >, and = . {{#expr: 5-{{CURRENTDOW}}}} producing: {{#switch: {{#expr: 5-{{CURRENTDOW}}}} |-1=6 |-2=5 |#default={{#expr: 5-{{CURRENTDOW}}}} }} producing: {{#switch: {{#expr: 5-{{CURRENTDOW}}}} |-1=There's still 6 more day(s) until Friday. |-2=There's still 5 more day(s) until Friday. |0=Yay, it's Friday! |#default=There's still {{#expr: 5-{{CURRENTDOW}}}} more day(s) until Friday. }} producing: {{#expr: {{CURRENTYEAR}}-1993}}</nowiki> That would produce this: {{#switch: {{#expr: {{CURRENTMONTH}}>=7}} |1={{#expr: {{CURRENTYEAR}}-1993}} |0={{#expr: {{CURRENTYEAR}}-1994}} }} The first line basically checks if the current month is after (greater than or equal to) July (7). If it is, the answer is true (1) and if it isn't, the answer is false (0). If the answer is false, the answer needs to be one number larger so we could either add one to the true (1) answer or just add one to our birthday (which is what we did). Since March occurs before July and 2025-1993=32, the code produces this: For those who are REALLY picky and want it to show their birthday exactly (according to the date, not the time) can use the code below which uses the same idea but adds to it. This code would be for someone who was born on August (8) 9th (9), 1993. {{#switch: {{#expr: {{CURRENTMONTH}}<8}} |1={{#expr: {{CURRENTYEAR}}-1994}} |0={{#switch: {{CURRENTMONTH}} |#default={{#expr: {{CURRENTYEAR}}-1993}} |8={{#switch: {{#expr: {{CURRENTDAY}}>=9}} |1={{#expr: {{CURRENTYEAR}}-1993}} |0={{#expr: {{CURRENTYEAR}}-1994}} }} }} }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Probably the most useful HTML tag is <div>. "div" is short for divider though it's purpose is nothing of the sort. A <div> tag can be used to apply CSS (Cascading Style Sheets) to a specific section of a page. It can be as simple as a background color or text alignment to as complicated as an absolute position. <span> is pretty much the same thing, but less recommended. The most useful purpose of the <span> tag is to hide the icon next to external links.
So if you wanted a message to appear at the top left of a page in a blue box, you might use the following: To remove the icon next to an external link, use the following code: <span class="plainlinks"></span>. And that's everything you need to know about div and span. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Members with the following badges will be able to assist you. To see the list of members, simply click on the image and scroll down to the list at the bottom of the page.
|