Help:Magic words

From binaryoption
Jump to navigation Jump to search
Баннер1
  1. Help:Magic words

Magic words are special keywords in MediaWiki that, when used in wiki text, perform specific actions or display dynamic information. They aren't displayed literally; instead, the wiki software interprets them and replaces them with something else – a date, a page count, a namespace name, or the result of a function. They are a powerful tool for creating templates, maintaining consistency, and automating tasks within a wiki. This guide provides a comprehensive overview of magic words, covering their syntax, categories, common examples, and how to leverage them effectively. This guide is geared towards beginners, assuming minimal prior knowledge of wiki markup.

Understanding the Basics

Magic words always begin with two percent signs (`%%`). The part following the first `%%` identifies the magic word itself. Some magic words require arguments – additional information provided after the magic word to customize its behavior. Arguments are separated from the magic word by a vertical bar (`|`). For example, `2025` displays the current year, while `https://binaryoption.wiki/index.php?title=Page_Title&action=edit` generates a full URL to edit the page "Page Title".

MediaWiki 1.40 supports a wide range of magic words, categorized by their function. The categories are:

  • Variables: These words display dynamic information like dates, times, page names, and user details.
  • Functions: These words perform actions, such as generating URLs, creating tables of contents, or including other pages.
  • Converters: These words change the format of text, like converting a number to a different numeral system.
  • Page Properties: These words retrieve information about a page, like its size or last modification date.
  • Parsers: These words control how the wiki text is parsed and rendered.
  • Language converters: These words translate text based on language settings.

Common Magic Words - Variables

These magic words display dynamic data.

  • `2025`: Displays the current year (e.g., 2024). Useful for copyright notices or date-sensitive content.
  • `07`: Displays the current month name (e.g., January).
  • `6`: Displays the current day of the month (e.g., 26).
  • `12:48`: Displays the current time in 24-hour format (e.g., 14:35).
  • `12`: Displays the current hour in 24-hour format (e.g., 14).
  • `Template:CURRENTMINUTE`: Displays the current minute (e.g., 35).
  • `Template:SEASON`: Displays the current season (based on the current date).
  • `Magic words`: Displays the name of the current page. Essential for templates that need to reference the page they're on.
  • `Magic_words`: Displays the encoded version of the page name, useful for URLs.
  • `Help`: Displays the namespace of the current page (e.g., "Help"). See Help:Namespaces for more information.
  • `Help`: Displays the encoded version of the namespace.
  • `42893`: Displays the unique numerical ID of the current page.
  • `43040`: Displays the revision ID of the current page.
  • `Help:Magic words`: Displays the full page name, including the namespace (e.g., "Help:Magic words").
  • `Help:Magic_words`: Displays the encoded version of the full page name.
  • `Template:SCRIPTNAME`: Displays the name of the script used to access the page.
  • `https://binaryoption.wiki`: Displays the server name.
  • `Template:SERVER NAME`: Displays the server's hostname.
  • `Template:SERVER SOFTWARE`: Displays the server software.
  • `Template:USER`: Displays the username of the current user.
  • `Template:USERNAME`: An alias for `Template:USER`.
  • `Template:USERID`: Displays the user ID of the current user.
  • `Template:USERS`: Displays a list of all users. (Use with caution, as this can be a very long list.)
  • `Template:RAWURL`: Displays the raw URL of the current page.
  • `Template:BASEURL`: Displays the base URL of the wiki.

Common Magic Words - Functions

These magic words perform actions.

  • `https://binaryoption.wiki/index.php?title=Page_Title&action=edit`: Generates a full URL to the specified page with the specified action (in this case, editing). Very useful for creating links to specific page states.
  • `/index.php?title=Page_Title&action=edit`: Generates a local URL relative to the wiki installation.
  • `text`: URL-encodes the given text. Important for creating valid URLs with special characters.
  • `Template:REVISIONSIZE:Page Title`: Returns the size of the specified page revision in bytes.
  • `92004`: Returns the revision ID of the specified page.
  • `binaryoption`: Displays the name of the wiki.
  • `Special:Search`: Creates a link to the Special:Search page. This can be used in templates to create search forms.
  • ``: Creates a link to the Special:WhatLinksHere page for the current page.
  • `Template:INTL:string`: Used for internationalization; displays a translated string based on the user's language preference. See Help:Internationalization.
  • `{{#if:condition|then|else}}`: A parser function that conditionally displays content based on a condition. A fundamental building block for complex templates.
  • `{{#switch:variable|case1|result1|case2|result2|...}}`: A parser function that performs different actions based on the value of a variable. Useful for creating menus or handling different input values.
  • `{{#vardefine:name|value}}`: Defines a variable that can be reused within a page or template.
  • `{{#varbyname:name}}`: Retrieves the value of a previously defined variable.
  • `{{#time:format|timestamp}}`: Formats a timestamp according to the specified format string. See Help:Formatting Dates and Times.
  • `{{#categorytoc}}`: Displays a table of contents for the categories on the page.
  • `{{#properties}}`: Displays the properties associated with the current page.

Common Magic Words - Converters

These magic words convert data.

  • `{{#binary:value}}`: Converts a decimal number to its binary representation.
  • `{{#decimal:value}}`: Converts a number to its decimal representation.
  • `{{#hex:value}}`: Converts a decimal number to its hexadecimal representation.
  • `{{#octal:value}}`: Converts a decimal number to its octal representation.
  • `{{#roman:number}}`: Converts a number to its Roman numeral representation.

Common Magic Words – Page Properties

These magic words retrieve information about a page.

Using Magic Words in Templates

Magic words are particularly powerful when used within Help:Templates. Templates allow you to create reusable blocks of wiki text that can be inserted into multiple pages. By using magic words within templates, you can create dynamic content that adapts to the specific page it's used on.

For example, a template for a project page might use `Magic words` to display the project's name and `2025` to automatically update the copyright notice. This ensures that the information is always accurate and consistent.

Advanced Techniques and Considerations

  • **Parser Functions:** The `#if` and `#switch` parser functions are incredibly versatile and allow you to create complex logic within your wiki pages and templates. Mastering these functions is key to unlocking the full potential of MediaWiki.
  • **Variable Scope:** Variables defined using `#vardefine` have a specific scope. They are typically only accessible within the same page or template.
  • **Error Handling:** Some magic words may return an error if they are used incorrectly or if the arguments are invalid. Use caution and test your code thoroughly.
  • **Performance:** Excessive use of complex magic words and parser functions can impact wiki performance. Optimize your code to minimize overhead.
  • **Custom Magic Words:** Administrators can add custom magic words to extend the functionality of the wiki. This requires programming knowledge and access to the wiki's configuration files.

Troubleshooting

  • **Magic word doesn't work:** Double-check the syntax, including the two percent signs (`%%`) and the vertical bar (`|`) for arguments. Ensure you're using the correct magic word name.
  • **Unexpected output:** Verify the arguments you're passing to the magic word. Consult the documentation for the specific magic word to understand its expected input.
  • **Error message:** Pay attention to the error message and try to understand what it's telling you. Common errors include invalid arguments or incorrect syntax.

Further Resources

Strategies, Technical Analysis, Indicators, and Trends

Understanding financial markets involves a multitude of strategies and tools. Here are some related concepts:

Help:Contents Help:Formatting Help:Templates Help:Parser Functions Help:Internationalization Help:Namespaces Manual:Configuration settings Manual:Extension installation Manual:Upgrading Manual:Administrators

Start Trading Now

Sign up at IQ Option (Minimum deposit $10) Open an account at Pocket Option (Minimum deposit $5)

Join Our Community

Subscribe to our Telegram channel @strategybin to receive: ✓ Daily trading signals ✓ Exclusive strategy analysis ✓ Market trend alerts ✓ Educational materials for beginners

Баннер