Help page: Edit

Editing Help:Substitution

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 77: Line 77:
 
=== An example of recursion in action ===
 
=== An example of recursion in action ===
  
This is an example using the actual [[Template:Aye]], and a hypothetical Template:Foo. You are attempting to include the Template:Foo, and indirectly the Template:Like, on a third page through transclusion and substitution. Template:Like displays this symbol: {{Aye}}
+
This is an example using the actual [[Template:Like]], and a hypothetical Template:Foo. You are attempting to include the Template:Foo, and indirectly the Template:Like, on a third page through transclusion and substitution. Template:Like displays this symbol: {{Like}}
  
For example, let's say the Template:Foo contained the wikitext <code><nowiki>{{Aye}}</nowiki></code>. If you then transclude it, using the wikitext <code><nowiki>{{Foo}}</nowiki></code>, this will transclude the Template:Like as you would expect. But if you use the wikitext <code><nowiki>{{subst:Foo}}</nowiki></code>, when you save it, you find the wikitext <code><nowiki>{{Aye}}</nowiki></code> substituted rather than the wikitext of the page Template:Aye. The substitution has not been recursive.
+
For example, let's say the Template:Foo contained the wikitext <code><nowiki>{{Like}}</nowiki></code>. If you then transclude it, using the wikitext <code><nowiki>{{Foo}}</nowiki></code>, this will transclude the Template:Like as you would expect. But if you use the wikitext <code><nowiki>{{subst:Foo}}</nowiki></code>, when you save it, you find the wikitext <code><nowiki>{{Like}}</nowiki></code> substituted rather than the wikitext of the page Template:Like. The substitution has not been recursive.
  
An example of recursion would be if the Template:Foo contained the wikitext <code><nowiki>{{{{{|safesubst:}}}Aye}}</nowiki></code>. Now if you transclude it, using the wikitext <code><nowiki>{{Foo}}</nowiki></code>, this will transclude the Template:Aye just as before. And if you save <code><nowiki>{{subst:Foo}}</nowiki></code> it will substitute the full actual wikitext of the Template:Like. You have therefore achieved recursive substitution.
+
An example of recursion would be if the Template:Foo contained the wikitext <code><nowiki>{{{{{|safesubst:}}}Like}}</nowiki></code>. Now if you transclude it, using the wikitext <code><nowiki>{{Foo}}</nowiki></code>, this will transclude the Template:Like just as before. And if you save <code><nowiki>{{subst:Foo}}</nowiki></code> it will substitute the full actual wikitext of the Template:Like. You have therefore achieved recursive substitution.
  
 
=== Further examples ===
 
=== Further examples ===

Please note that all contributions to BattleTechWiki are considered to be released under the GNU FDL 1.2 (see BattleTechWiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)

Advanced templates:

Editing: {{Merge}}   {{Moratorium}}   {{Otheruses| | | }}

Notices: {{NoEdit}}   {{Sign}}   {{Unsigned|name}}   {{Welcome}}

Administration: {{Essay}}   {{Policy}}   {{Procedure}}

Templates used on this page:

This page is a member of 2 hidden categories: