Vorlage:Subst check top/Doku: Unterschied zwischen den Versionen

Aus skandinavien-wiki.net
imported>MSGJ
imported>Thesevenseas
(Updated Code)
Zeile 4: Zeile 4:
=== Usage ===
=== Usage ===


Place {{#switch: {{BASEPAGENAME}} | Substchecktop=this template and {{tl|substcheckbottom}} | Substcheckbottom=this template and {{tl|substchecktop}} | #default=these templates }} onto the main template in the following manner.
Place {{#switch: {{BASEPAGENAME}} | Subst check top=this template and {{tl|substcheckbottom}} | Subst check bottom=this template and {{tl|substchecktop}} | #default=these templates }} onto the main template in the following manner.


<code><nowiki>{{{{{|safesubst:}}}substchecktop|[template pagename]|subst={{{subst|}}}}}</nowiki></code>
<code><nowiki>{{{{{|safesubst:}}}substchecktop|[template pagename]|subst={{{subst|}}}}}</nowiki></code>
Zeile 12: Zeile 12:
<code><nowiki>{{{{{|safesubst:}}}substcheckbottom|subst={{{subst|}}}}}</nowiki></code>
<code><nowiki>{{{{{|safesubst:}}}substcheckbottom|subst={{{subst|}}}}}</nowiki></code>


{{#switch: {{BASEPAGENAME}} | Substchecktop=This template, along with {{tl|substcheckbottom}}, | Substcheckbottom=This template, along with {{tl|substchecktop}}, | #default=These templates }} will check the main template for substitution and give an error message if it has been accidentally transcluded by having {{#ifeq: {{BASEPAGENAME}} | Substchecktop | this template | {{tl|substchecktop}} }} placed above the main template code and {{#ifeq: {{BASEPAGENAME}} | Substcheckbottom | this template | {{tl|substcheckbottom}} }} placed below the main template code.
{{#switch: {{BASEPAGENAME}} | Subst check top=This template, along with {{tl|substcheckbottom}}, | Subst check bottom=This template, along with {{tl|substchecktop}}, | #default=These templates }} will check the main template for substitution and give an error message if it has been accidentally transcluded by having {{#ifeq: {{BASEPAGENAME}} | Subst check top | this template | {{tl|substchecktop}} }} placed above the main template code and {{#ifeq: {{BASEPAGENAME}} | Subst check bottom | this template | {{tl|substcheckbottom}} }} placed below the main template code.


{{#ifeq: {{BASEPAGENAME}} | Substchecktop | This template | {{tl|substchecktop}} }} takes in an input for the main template name as a parameter. This is shown above as <code><nowiki>[template pagename]</nowiki></code>. This parameter should be entered so that the default error message refers to the correct main template. This default error message can be optionally replaced by a custom error message by using the message parameter. This parameter accepts templates and it is recommended that a message template be used for long messages to keep the parameter value short. {{#ifeq: {{BASEPAGENAME}} | Substcheckbottom | This template | {{tl|substcheckbottom}} }} does not use these parameters.
{{#ifeq: {{BASEPAGENAME}} | Subst check top | This template | {{tl|substchecktop}} }} takes in an input for the main template name as a parameter. This is shown above as <code><nowiki>[template pagename]</nowiki></code>. This parameter should be entered so that the default error message refers to the correct main template. This default error message can be optionally replaced by a custom error message by using the message parameter. This parameter accepts templates and it is recommended that a message template be used for long messages to keep the parameter value short. {{#ifeq: {{BASEPAGENAME}} | Subst check bottom | This template | {{tl|substcheckbottom}} }} does not use these parameters.


Both {{#switch: {{BASEPAGENAME}} | Substchecktop=this template and {{tl|substcheckbottom}} | Substcheckbottom=this template and {{tl|substchecktop}} | #default=these templates }} use <code><nowiki>subst={{{subst|}}}</nowiki></code> as one of the parameters. This allows optional transclusion for demonstration purposes by setting the subst parameter on the main template to nosubst.
Both {{#switch: {{BASEPAGENAME}} | Subst check top=this template and {{tl|substcheckbottom}} | Subst check bottom=this template and {{tl|substchecktop}} | #default=these templates }} use <code><nowiki>subst={{{subst|}}}</nowiki></code> as one of the parameters. This allows optional transclusion for demonstration purposes by setting the subst parameter on the main template to nosubst.


=== See also ===
=== See also ===
Zeile 23: Zeile 23:
* [[Template:Issubst|Issubst]]
* [[Template:Issubst|Issubst]]
* [[Template:Require subst|Require subst]]
* [[Template:Require subst|Require subst]]
*{{#ifeq: {{BASEPAGENAME}} | Substchecktop || [[Template:Substchecktop|Substchecktop]] }}
*{{#ifeq: {{BASEPAGENAME}} | Subst check top || [[Template:Substchecktop|Substchecktop]] }}
*{{#ifeq: {{BASEPAGENAME}} | Substcheckbottom || [[Template:Substcheckbottom|Substcheckbottom]] }}
*{{#ifeq: {{BASEPAGENAME}} | Subst check bottom || [[Template:Substcheckbottom|Substcheckbottom]] }}


<includeonly>
<includeonly>

Version vom 10. September 2010, 00:37 Uhr

Usage

Place this template and {{substcheckbottom}} onto the main template in the following manner.

{{{{{|safesubst:}}}substchecktop|[template pagename]|subst={{{subst|}}}}}

...template code...

{{{{{|safesubst:}}}substcheckbottom|subst={{{subst|}}}}}

This template, along with {{substcheckbottom}}, will check the main template for substitution and give an error message if it has been accidentally transcluded by having this template placed above the main template code and {{substcheckbottom}} placed below the main template code.

This template takes in an input for the main template name as a parameter. This is shown above as [template pagename]. This parameter should be entered so that the default error message refers to the correct main template. This default error message can be optionally replaced by a custom error message by using the message parameter. This parameter accepts templates and it is recommended that a message template be used for long messages to keep the parameter value short. {{substcheckbottom}} does not use these parameters.

Both this template and {{substcheckbottom}} use subst={{{subst|}}} as one of the parameters. This allows optional transclusion for demonstration purposes by setting the subst parameter on the main template to nosubst.

See also