More actions
No edit summary |
No edit summary |
||
| Line 8: | Line 8: | ||
This module returns the name of the page it is being transcluded from. This differs from {{((}}FULLPAGENAME{{))}} which returns the name of the currently viewed page even if it is called from a template. To use this doc page as an example, <code><nowiki>{{#invoke:TEMPLATENAME|main}}</nowiki></code> -> <samp>{{#invoke:TEMPLATENAME|main}}</samp> while <code><nowiki>{{FULLPAGENAME}}</nowiki></code> -> <samp>{{FULLPAGENAME}}</samp>. | This module returns the name of the page it is being transcluded from. This differs from {{((}}FULLPAGENAME{{))}} which returns the name of the currently viewed page even if it is called from a template. To use this doc page as an example, <code><nowiki>{{#invoke:TEMPLATENAME|main}}</nowiki></code> -> <samp>{{#invoke:TEMPLATENAME|main}}</samp> while <code><nowiki>{{FULLPAGENAME}}</nowiki></code> -> <samp>{{FULLPAGENAME}}</samp>. | ||
To get the same behavior for | To get the same behavior for variables other than <code><nowiki>{{FULLPAGENAME}}</nowiki></code>, this module can be passed as a parameter to them as in: | ||
<code><nowiki>{{PAGENAME:{{#invoke:TEMPLATENAME|main}}}}</nowiki></code> -> <samp>{{PAGENAME:{{#invoke:TEMPLATENAME|main}}}}</samp>. | <code><nowiki>{{PAGENAME:{{#invoke:TEMPLATENAME|main}}}}</nowiki></code> -> <samp>{{PAGENAME:{{#invoke:TEMPLATENAME|main}}}}</samp>. | ||
Revision as of 18:00, 6 April 2025
| This page uses Creative Commons Licensed content from Wikipedia (view authors). |
Usage
{{#invoke:TEMPLATENAME|main}}
This module returns the name of the page it is being transcluded from. This differs from Template:((FULLPAGENAMETemplate:)) which returns the name of the currently viewed page even if it is called from a template. To use this doc page as an example, {{#invoke:TEMPLATENAME|main}} -> Module:TEMPLATENAME/doc while {{FULLPAGENAME}} -> Module:TEMPLATENAME/doc.
To get the same behavior for variables other than {{FULLPAGENAME}}, this module can be passed as a parameter to them as in:
{{PAGENAME:{{#invoke:TEMPLATENAME|main}}}} -> TEMPLATENAME/doc.