This site is supported by donations to The OEIS Foundation.
Template:Basepage name
[⧼Purge⧽ Template:Basepage name]
The {{basepage name}} workaround template gives the 8 th to last down to the 2 nd to last pagename part (i.e. excludes the [current] last subpage part) of either {{PAGENAME}} or {{PAGENAMEE}} (URL encoded option). Up to seven levels of subpages should be enough!
It should be used when the {{BASEPAGENAME}} or {{BASEPAGENAMEE}} (URL encoded version) magic words don't work properly, i.e. in a namespace that doesn't have its subpages enabled (e.g. the Template namespace).
NOTE: The {{BASEPAGENAME}} and {{SUBPAGENAME}} magic words only work in namespaces that have subpages enabled. See Manual:$wgNamespacesWithSubpages for information on enabling subpages.
For example
- {{BASEPAGENAME}}
gives the wrong result (if viewed from {{basepage name/doc}})
- Basepage name
while using
- {{basepage name}}
we get the desired result
See {{Citation/make link/doc}} for an example with 2 levels of subpages (the test is commented out, just temporarily uncomment to redo the test, but do not save).
Note that if there is no parent page, the base page name is the same as the page name.
Contents
URL encoded
NOTE: The {{BASEPAGENAMEE}} and {{SUBPAGENAMEE}} magic words only work in namespaces that have subpages enabled. See Manual:$wgNamespacesWithSubpages for information on enabling subpages.
For example
- {{BASEPAGENAMEE}}
gives the wrong result (if viewed from {{basepage name/doc}})
- Basepage_name
while using
- {{basepage name|e}}
we get the desired result
See {{Citation/make link/doc}} for an example with 2 levels of subpages (the test is commented out, just temporarily uncomment to redo the test, but do not save).
Note that if there is no parent page, the base page name is the same as the page name.
Code
<noinclude>{{Documentation}}</noinclude><includeonly><!-- Up to 8 levels should be enough! -->{{#switch: {{lc: {{{1|}}} }} | url encoded | encoded | e = <!-- -->{{#if: {{#explode: {{PAGENAMEE}}|/|-8}} |{{#explode: {{PAGENAMEE}}|/|-8}}/}}<!-- -->{{#if: {{#explode: {{PAGENAMEE}}|/|-7}} |{{#explode: {{PAGENAMEE}}|/|-7}}/}}<!-- -->{{#if: {{#explode: {{PAGENAMEE}}|/|-6}} |{{#explode: {{PAGENAMEE}}|/|-6}}/}}<!-- -->{{#if: {{#explode: {{PAGENAMEE}}|/|-5}} |{{#explode: {{PAGENAMEE}}|/|-5}}/}}<!-- -->{{#if: {{#explode: {{PAGENAMEE}}|/|-4}} |{{#explode: {{PAGENAMEE}}|/|-4}}/}}<!-- -->{{#if: {{#explode: {{PAGENAMEE}}|/|-3}} |{{#explode: {{PAGENAMEE}}|/|-3}}/}}<!-- -->{{#if: {{#explode: {{PAGENAMEE}}|/|-2}} |{{#explode: {{PAGENAMEE}}|/|-2}}}}<!-- --> | #default = <!-- -->{{#if: {{#explode: {{PAGENAME}}|/|-8}} |{{#explode: {{PAGENAME}}|/|-8}}/}}<!-- -->{{#if: {{#explode: {{PAGENAME}}|/|-7}} |{{#explode: {{PAGENAME}}|/|-7}}/}}<!-- -->{{#if: {{#explode: {{PAGENAME}}|/|-6}} |{{#explode: {{PAGENAME}}|/|-6}}/}}<!-- -->{{#if: {{#explode: {{PAGENAME}}|/|-5}} |{{#explode: {{PAGENAME}}|/|-5}}/}}<!-- -->{{#if: {{#explode: {{PAGENAME}}|/|-4}} |{{#explode: {{PAGENAME}}|/|-4}}/}}<!-- -->{{#if: {{#explode: {{PAGENAME}}|/|-3}} |{{#explode: {{PAGENAME}}|/|-3}}/}}<!-- -->{{#if: {{#explode: {{PAGENAME}}|/|-2}} |{{#explode: {{PAGENAME}}|/|-2}}}}<!-- -->}}</includeonly>
See also
- {{subpage name}}