Помощь:Шаблоны

You can help by updating the translation.
Also, please make sure the article complies with the alternate languages guide.
This notice is put here by LanguageBar template and if you want to remove it after updating the translation you can do so on this page.

This page either contains information that is only partially or incorrectly translated, or there isn't a translation yet.
If this page cannot be translated for some reason, or is left untranslated for an extended period of time after this notice is posted, the page should be requested to be deleted.
Also, please make sure the article complies with the alternate languages guide.
Шаблон это страница, созданная для использования на других страницах. Шаблоны обычно содержат повторяющуюся информацию, которая может потребоваться для отображения в большем количестве статей или страниц. Они обычно используются для создания стандартных сообщений, предупреждений или уведомлений, информационных блоков, навигационных панелей и тому подобных целей.
Шаблоны позволяют создавать страницы намного быстрее иудобнее. Шаблоны очень часто используются на страницах, поэтому лучше узнать о них заранее. Когда платформа Wiki определяет шаблон при обработке страницы, он автоматически заменяется соотвествующим содержимым. Что там появится, зависит от пользователей.
Как использовать шаблон
Прежде чем шаблон может быть добавлен куда-либо, сначала его содержимое должно быть определено на его собственной странице. Страницы шаблонов должны начинаться с префикса Template:
.
Шаблоны имеют некоторые ограниченные возможности программирования, что даёт им много возможностей. Подробнее о них мы поговорим позже.
Чтобы добавить шаблон на страницу (это называется интеграция), просто введите {{
, имя шаблона, а затем }}
.
Если вы хотите добавить какие-либо параметры, поместите |
между именем шаблона и }}
и определите параметры там. Все параметры, которые Вы определите, должны быть разделены ещё одним символом |
.

{{:Main Page}}
, но мы не делаем этого здесь, потому что это добавило бы все заголовки главной страницы в оглавление этой страницы.Примеры
Вот шаблон, в котором мы не определено никаких параметров. При просмотре страницы выражение {{restart}}
(или {{Restart}}
) будет заменено содержимым шаблона Template:Restart. Если Вы зайдете на страницу этого шаблона, то увидите, что в нём всего пять слов.
{{restart}}
→ Для применения изменений требуется перезапуск.
Шаблон command - это шаблон, который может принимать до двух безымянных параметров.
{{Command|sv_cheats|1}}
Результат: sv_cheats 1
Безымянные параметры должны быть определены в определённом порядке.
Подстановка (для опытных пользователей)
Instead of transcluding a template, one can choose to substitute it. Substitution will replace a template with the contents of the template directly onto the page. To substitute a template, transclude it like you normally would, then add subst:
between {{
and the template's name. After that, click the save button and the wikitext will automatically be added. Do not substitute carelessly, because the substituted wikitext will not be updated when the template is. See Wikipedia:Help:Substitution for more information.
{{subst:delete|This is a bad page.}}
When the page is saved, that text will be replaced with this:
{{Delete-meta|{{#if: This is a bad page. | This is a bad page. }} }}[[Category:Candidates for speedy deletion]]
Note the automatic forwarding of parameters. When substituting, the page should not appear any differently than it would if transcluded. The only difference is in the page code.
Создание шаблонов
Making a template like Template:Restart is rather easy - just type the text you want, and save it. What about ones with parameters?

<!-- -->
) can also be useful.Безымянные параметры
To add an unnamed parameter, simply put {{{1}}}
where you want it to be.
Here's part of the code for Template:Tip:
Tip:{{{1}}}
If you've seen this template before you know that it has its own special look, but this is all we will look at for now. All the user has to do when transcluding this is enter the text they want:
{{tip|Do not carve without vertex editing afterward.}}
Результат:

If you want to add more than one unnamed parameter, simply change the number. Here's the old (condensed) code for Template:Distinguish:
:''Not to be confused with [[:{{{1}}}]]{{#if:{{{2|}}} |{{#if:{{{3|}}} |, [[:{{{2}}}]]| or [[:{{{2}}}]].}}|.}}{{#if:{{{3|}}} |{{#if:{{{4|}}} |, [[:{{{3}}}]]|, or [[:{{{3}}}]].}}}}{{#if:{{{4|}}} |, or [[:{{{4}}}]].}}''
This template has some things we haven't talked about yet, but you can still see that there's four unnamed parameters used: {{{1}}}
, {{{2}}}
, {{{3}}}
, and {{{4}}}
.
All the user has to do when transcluding is this:
{{distinguish|Combine|Civil Protection|Overwatch}}
Результат:
Именованные параметры
Usually you would want to have named parameters affect anything only if they are defined when being transcluded. We'll talk about conditions later. For now, let's look at Template:IO, which has many named parameters. In this template, {{{param}}}
marks a place to add wikitext that's defined by |param=texthere
when transcluding.
With named parameter:
{{IO|SetString|Updates the string.|param=string}}
Результат:
- SetString <строка >
- Updates the string.
Without named parameter:
{{IO|SetString|Updates the string.}}
Результат:
- SetString
- Updates the string.
Значение по умолчанию
To make a parameter have a value by default, add a |
to the right of the parameter name, and then define the value. Named and unnamed parameters can use this.
{{{1|3000}}}
This would make the value for 1
3000.
{{{value|}}}
This returns nothing. Without the |
, it would literally return "{{{value}}}" as text, if it hasn't already been defined at some other point.
Функции анализатора
#if:
checks if a string or parameter has anything inside it.
{{#if: {{{target|}}} | Target aqcuired | Sleep mode activated... }}
Результат: Sleep mode activated... (The parameter {{{target|}}}
returns null because you (probably) are not viewing this page through a transclusion, so it's never had a chance to be defined.)
{{#if: Something is there! | Target aqcuired | Sleep mode activated... }}
Результат: Target aqcuired
#ifeq:
checks for equality between two strings. It can be used with parameters as well.
{{#ifeq: {{{target|}}} | friend | Friend... | Go away! }}
Результат: Go away!
{{#ifeq: friend | friend | Friend... | Go away! }}
Результат: Friend...
#expr:
solves math problems.
{{#expr: 2 + 2}}
Результат: 4
See m:Help:Calculation for all it's abilities.
#ifexpr:
tells if a math expression is correct.
{{#ifexpr: 6 + 3 = 9 | Right | Wrong }}
Результат: Right
{{#ifexpr: 6 + 3 = 23 | Right | Wrong }}
Результат: Wrong
Документация
Пожалуйста, добавляйте описание вашего шаблона, и особенно приведите примеры его использования. Чтобы текст описания не появлялся на страницах, использующих шаблон, или чтобы сама страница шаблона выглядела аккуратно, Вы можете использовать три следующих HTML-метки
<noinclude>...</noinclude>
предотвращает перенос wiki-текста на другие страницы. Он будет отображаться только на странице шаблона.<onlyinclude>...</onlyinclude>
предписывает отображать на использующих страницах только wiki-текст шаблона. Все остальное не будет использовано, но все равно будет отображаться на странице шаблона.<includeonly>...</includeonly>
предотвращает появление внутреннего wiki-текста на странице шаблона. Это никак не влияет на использующую шаблон страницу.
So you can either surround everything that should be transcluded with <onlyinclude>
or surround everything else with <noinclude>
. In addition, you can use <includeonly>
to hide the template text on the template page.
The tags can sound very confusing at first. If you're confused on how to use them, check the source code for a template, because almost all use them for one purpose or another.
If the documentation cannot be kept short, then it is a good idea to move all explanations and/or examples to an own page. By convention, the documentation page of a template should be its subpage /doc
. For instance, Template:Note has its documentation page Template:Note/doc. When created, the documentation is transcluded to the template page using just the expression {{doc}} which of course must be excluded using the above tags.
Sometimes, templates are used identically. As you might know, Template:Tip and Template:Note both use their one parameter in exactly the same manner, so there is no need for another page with an identical documentation for Tip. Tip can use the same documentation as Note using the expression {{documentation|Template:Note/doc}}
; The only magic behind this is that Template:Note/doc uses the expression {{ROOTPAGENAME}}
instead of Note
for its examples so that the examples adapt to the page that they are displayed on. If Template:Note/doc wasn't made for this, this wouldn't work out.
Other "generic docs" like this that are in use are Template:Hl2 and Template:Yes.
Шаблоны не обновляются
If you've recently edited a template and the changes are not applying on pages it's been transcluded to, add ?action=purge
at the end of the URL for those pages. This will tell the server to update the page's HTML immediately. You can achieve the same effect by editing a page and saving it without making any changes.
Ярлыки шаблонов
Some templates may have template shortcuts, which are redirects that are abbreviated or otherwise different forms of their target templates. Template shortcuts can be transcluded just like their target templates.
Переводы
Templates should include translations so that people who natively speak other languages can more easily understand the contents of the template. There are two ways this can be accomplished.
Первый метод: {{Autolang}}
This is usually used on smaller templates with little text. This template automatically detects the language of the UI and gives the appropriate translation, if available. This is usually sufficient, however on larger templates it is usually recommended to use Method Two.
Второй метод: Подстраницы строк
Larger templates (e.g. {{Software page}}
) tend to have large amounts of text, and having them all on one page makes it pointlessly cluttered and very hard to edit. To solve this, almost all text on these templates go on a Strings Subpage (e.g. {{Software page/strings}}
), which, when a specific string is specified, will present the appropriately translated text. This helps make not only text editing but translating much easier because editors don't have to shift through lots of code to find a small bit of text they want to edit/translate. This can he very complicated for smaller templates however, so it is usually reserved for larger templates.

Полезные шаблоны
All templates in green text are that color so that they stand out against the greyscale tones of most pages. Most templates with that color also automatically add pages they are transcluded on into Category:TODO.
Именные шаблоны
All games have templates named by their shortcut that can deliver their associated icon and/or a link to their page. See Category:Game icons for a full list of game shortcuts. All of them accept the same set of parameters that are described on every template page. The following table should give examples and also give ideas on when to use them.
Wiki-текст | Пример | Описание | Ранее используемый шаблон/Альтернатива | ||
---|---|---|---|---|---|
{{<shortcut>}} |
{{hl2}} | → | ![]() |
Displays the game's icon which links to its game's page and shows the game's name as a hover text. Putting this at the beginning (or end) of a word or line is the shortest and most common way of clarifying that something applies only to a specific game, but there are more ways. | |
{{<shortcut>|2}} |
{{hl2|2}} |
→ | ![]() |
Displays the game's icon followed by its name which both link to the game's page. Useful in sentences when the icon alone is too little but the next style is too much. | {{game link}} [![]() |
{{<shortcut>|4}} |
{{hl2|4}} |
→ | ![]() |
Does the same but using colorful text which grabs more attention, so don't overuse this on a page. Especially if you name the same game multiple times in a text, you definitely don't need a long, colorful link every time, let alone a link. | {{game name}} [![]() |
{{<shortcut>|in}} |
{{hl2|in}} |
→ | (в ![]() |
Can be used to indicate that something applies to a specific game. Useful at the end of a line or key word; The same applies to the following variants. | {{in}} |
{{<shortcut>|since}} |
{{portal2|since}} |
→ | (Во всех играх начиная с ![]() |
Can be used to quickly note features that were added in a game and are available in all Source games afterwards. | {{since}} |
{{<shortcut>|only}} |
{{csgo|only}} |
→ | (только в ![]() |
Indicates features that are exclusive to a specific game. | {{only}} |
{{<shortcut>|also}} |
{{as|since}} {{gmod|also}} |
→ | (Во всех играх начиная с ![]() ![]() |
Notes that earlier game also has a feature, usually backported from newer engine branches. These should be used with in conjunction with another game notice template. | {{also}} |
{{<shortcut>|removed}} |
{{l4d|removed}} |
→ | (удалено начиная с ![]() |
Indicates that a feature was removed in a game and all later engine branches. | {{removed}} |
{{<shortcut>|not}} |
{{czds|not}} |
→ | (нет в ![]() |
Indicates that a feature might be in other games but not in a specific one. | {{not}} |
Шаблоны внутренних заметок
The following are some of the inline note templates.
Описание | Wiki-текст и Результат |
---|---|
Template:Bug notifies readers of a bug. | {{bug|The amount is double what it should be. Be careful!}} ![]() |
Template:Clarify marks things that should be clarified. | PAS is a kind of bounding-box for Player or NPC AI sound detection. PAS is a kind of bounding-box for Player or NPC AI sound detection.[Уточнить] |
Template:Confirm marks something that needs to be confirmed. It's green color is meant to stand out. | {{confirm|Always goes to the left.}} ![]() |
Always goes to the left. Always goes to the left.[подтвердить] | |
Template:Distinguish lets you notify users about pages that share similar names or may be confused for something else. | {{distinguish|"Follow Freeman!"|desc1=The HL2 chapter}} Не следует путать с "Follow Freeman!" (The HL2 chapter).
|
Template:How asks the question how? | Players can get past these. Players can get past these.[Как?] |
Template:Idea is a nifty way to suggest ideas. | {{idea|Reward players for being clever and creative, instead of forcing things to be only one way.}} ![]() |
Template:Main notes that there is a more detailed article about a certain topic. | {{main|Soundscripts}} Основная статья: Soundscripts
|
Template:Note is for making notes stand out more. | {{note|This will spawn at the map origin if you do not specify the position.}} ![]() |
Template:Question denotes a question | {{question|Does this work in newer engine branches?}} ![]() |
Template:Suggestion is for suggesting something | {{suggestion|Levels should be optimized for peak performance.}} ![]() |
Template:Tip marks text as a tip to readers. | {{tip|This is a much less tricky process when using the vertex edit tool as well.}} ![]() |
Template:Todo marks things that need to be done. It's green color is meant to stand out. | {{todo|Find where this is in the game files.}} To do: Find where this is in the game files. |
Template:Warning marks things that readers should take caution of when doing something. | {{warning|This tool has been known to corrupt files. Try an alternative listed below.}} ![]() |
Template:Workaround informs readers of a workaround | {{workaround|This should be automated with logic instead.}} ![]() |
Template:Why asks the question why? | This shader has been deprecated. This shader has been deprecated.[Почему?] |
Шаблоны уведомлений
The following is a list of some notice templates.
Описание | Wiki-текст и Результат |
---|---|
{{Cleanup}} marks a page that needs to be fixed up, preferably by someone knowledgeable. The text message is optional. If you do not give sufficient reason for the notice on the transclusion or the talk page, expect it to be removed by someone else. | {{cleanup|The last section needs to be clarified.}} ![]() This article or section needs to be cleaned up to conform to a higher standard of quality because:
The last section needs to be clarified For help, see the VDC Editing Help and Wikipedia cleanup process. Also, remember to check for any notes left by the tagger at this article's talk page. |
{{Delete}} marks a page that should be deleted. If you do not give sufficient reason for the notice on the transclusion or the talk page, expect it to be removed by someone else. When putting this on a page, you should also list the reason on that page's talk page, for any future readers that may want to know the purpose of the deletion. | {{delete}}
![]() This help page has been marked as a candidate for speedy deletion.
If you object to this decision, then please discuss why here (If you make a discussion section also create this redirect page). If this page doesn't meet the criteria for speedy deletion, then please remove this notice, but do not remove it from pages that you have created yourself Administrators / Moderators - Remember to check if anything links here and the page history before deleting. |
{{Merge}} is a notice that notifies editors that it's been suggested for two or more pages to be combined into one. All merges should be discussed before being done. | {{merge|HDR}} |
{{Split-apart}} marks pages that should be split into multiple pages. All splits should be discussed before being done. | {{split-apart}}
|
{{Moveto}} marks pages that should be moved to a different title, or sections of an article that should be moved to either another article or to their own new one. All moves should be discussed before being done. | {{Moveto}} ![]() Было предложено перенести эту статью или раздел в [[{{{1}}}]]. (Обсуждение)
|
{{screenshot}} marks pages that should have more images on them. It allows for an optional text message to clarify what needs images. | {{screenshot}} ![]() This article or section needs a screenshot to help visually convey the subject.
You can upload screenshots at Special:Upload. For help, see Help:Images.
|
{{Obsolete}} marks things that should no longer be used. Accepts three parameters, entity, tool, and shader. | {{obsolete|entity=1}} ![]() This entity is obsolete; its use is discouraged and it may only exist/function in older engine branches.
|
{{Spammer}} marks users that should be banned for spamming. For suspicious but not bannable behavior, there is also Template:Minor Spammer. ![]() |
{{spammer}} ![]()
|
{{Banned user}} marks users that have been banned (usually by Valve employees) for spamming, vandalizing pages, edit warring or trolling along with many other reasons. | {{Banned user}}
![]() This user has been banned for an unspecified reason, such as
![]() ![]() ![]() ![]() ![]() ![]() |
{{Stub}} marks pages that are very small. See Help:Stubs for info on using. | {{stub}} |
{{Translate}} marks pages where translation is needed and adds the page to a category. | {{Translate}} ![]() This page needs to be translated.
This page either contains information that is only partially or incorrectly translated, or there isn't a translation yet. If this page cannot be translated for some reason, or is left untranslated for an extended period of time after this notice is posted, the page should be requested to be deleted. Also, please make sure the article complies with the alternate languages guide. |
{{Update}} marks outdated pages. | {{update}} ![]() This article or section needs to be updated to include current information regarding the subject.
Remember to check for any notes left by the tagger at this article's talk page. |
{{Wip}} marks pages that are in the middle of major edits. The adder requests that other users do not edit in the meantime. | {{Wip}} ![]() This Help page is actively undergoing a major edit.
As a courtesy, please do not edit this Help while this message is displayed. If this page has not been edited for at least several hours to a few days, please remove this template. This message is intended to help reduce edit conflicts; please remove it between editing sessions to allow others to edit the page. The person who added this notice will be listed in its edit history should you wish to contact them.
|
{{Draft}} marks pages that are currently being worked on. | {{draft}} ![]() This is a draft help page. It is a work in progress open to editing by anyone.
Remember to check for any notes left by the tagger at this article's talk page.
|
{{Rewrite}} marks pages that are being rewritten, usually with a wip version on another page. | {{Rewrite|Help:Templates}} ![]() This help is currently being rewritten.
The rewrite can be found at Help:Templates. You can discuss the changes here. |
Прочие шаблоны
These templates have the purpose of helping the editor.
Описание | Wiki-текст и Результат |
---|---|
Template:= is a template that only returns an equal sign. The character is sometimes needed because multiple wiki features make use of it. Especially, the equals sign is a special character in template calls, so if an equals sign should be passed as a parameter value, then {{=}} is needed for "escaping". For the same purpose, there is also Template:! for a pipe, Template:((( for curly brackets and many more, see Category:Templates for within templates.
|
{{=}} = |
{{note|If x {{=}} 0, you lose.}} ![]() | |
Template:Clr clears the vertical space to the left and right of floating tables, floating images etc. To clear only one side, use {{clr|left}} or {{clr|right}} . This is commonly used before headlines to push them down so that they don't appear next to an image. In the example on the right, one could also use {{clr|left}} for the same effect.
|
[[File:Skull and crossbones.png|50px|left]]
This text is next to the image.{{clr}}This text is below the image. This text is next to the image.This text is below the image. |
Template:Ent is a really small template for making text that's both code and a link. | {{ent|noclip}} noclip |
Template:Expand or Template:ExpandBox allows you to hide stuff inside a box that can be shrunk down so that it doesn't make pages as long. | class="mw-collapsible mw-collapsed" style="background:rgba(0,0,0,0.05) ;float:no;margin-bottom:1em;margin-left:0;padding-right:0.5em;border:1px solid rgba(255,255,255,0.1); border-left:solid 1px #8bb9e0; padding-left:1em;" |
|-
| {{ExpandBox|
{{KV BaseEntity|noscroll=1}}
}}
|-
| Template:MultiPage is used for translations, which replaced the deprecated {{Lang}} template, which stands for language. This page itself uses the MultiPage template, using the wikitext {{MultiPage}}
, and with the {{Language subpage}} template added to the language subpages (for example, it is located in Help:Templates/en for English language, containing everything else with the {{Language subpage}} template on top).
The {{MultiPage}}, and it's predecessor, {{Lang}} template creates flags at the top right corner of a page such as
and thus must be the first template to be transcluded to be in the right position.
Every page can and should use this template as it lets the reader know of the existence of (correctly titled) language pages of the current page and clicking on the flags links to them. Read more on Template:MultiPage.
| {{lang|Help:Templates}}
The result is at the very top of this page.
|-
| Template:Param displays the values like parameters in the way that they are used in templates. Useful for template documentations.
| {{param|color|#fff}}
{{{color|#FFF}}}
|- | Template:Shortcut displays a small box noting (abbreviated) redirects to a page.
| {{shortcut|VDC:AL}}
|-
| Template:Tl2 stands for Template Link (2 as it is a replacement for an older template). It creates a link to a template surrounded by {{ }}. It also accepts parameters that act like parameters for the template that is linked to.
| {{tl2|note|Example}}
{{note|Example}}
|-
| Template:Tlc does the same but not creating a link, which is useful when trying to display template examples (like this entire page!).
| {{tlc|note|Example}}
{{note|Example}}
|-
| Template:Toc-right shifts the table of contents over to the right side of a page.
| For an example, see Half-Life 2 map reference.
|-
| Template:Unsigned is for talk pages. It should be added at the ends of unsigned comments.
| {{unsigned|JeffLane}}
—Неподписанный коментарий добавлен JeffLane (разговор • вклад)
|}
Специальные метки
Специальные метки - это символьные строки, которые являются своего рода шаблонами. Чтобы применить одну из них, просто введите её на странице.
__TOC__
Указывает место размещения оглавления на странице.
__FORCETOC__
Предписывает разместить оглавление в обычном месте. (Полезно для страниц, на которых недостаточно разделов для автоматического отображения оглавления)
__NOTOC__
Предписывает скрыть оглавление страницы.
__HIDDENCAT__
Помечает категорию как скрытую. Чтобы сайт отображал скрытые категории для вас, установите флажок Показывать скрытые категории в разделе Настройки.
__NOINDEX__
Указывает поистовым роботам не индексировать содержимое страницы, чтобы они не отображались в результатах поиска. Также добавляет страницу в категорию Неиндексируемые страницы. It has no effect on articles (in practice, because there are almost no patrolled edits on this wiki), but always effects other namespaces (such as templates, user pages, talk pages, etc.)
{{DISPLAYTITLE:title}}
Changes the title of a page at the top bar only.
Смотри также
- Special:ExpandTemplates - Показывает полностью обработанные шаблоны, включая замену кода wiki-текста и автоматическую подстановку всех вложенных шаблонов.
- Special:MostTranscludedPages - Список шаблонов, наиболее часто используемых на страницах. На самом деле это будут не только шаблоны, но и любые интегрированные страницы.
- Special:UncategorizedTemplates - Список шаблонов, которые не включены в категории.
- Special:UnusedTemplates - Список шаблонов, которые нигде не используются.
- Special:WantedTemplates - Список шаблонов, которые использованы на страницах, но не существуют. В идеале этот список должен быть пустым.
- Wikipedia:Help:Magic_words_for_beginners - Подробнее о специальных метках.
- Wikipedia:Help:Template - Очень полезный ресурс для программирования шаблонов..
- New Help Desk - Questions? Ask here.