Difference between revisions of "Template:If pagename"

From Geohashing
(Using the parameter pipe-trick instead of #ifeq, to detect defined parameters. Much more efficient, and shorter and clearer code. Then it needs the surrounding whitespace stripping.)
(Since the new code is so efficient: Adding 6 and 8 character partial matching, as in "/someth*" and "/somethin*".)
Line 12: Line 12:
 
           | <!--Check for match with "/some*"-->
 
           | <!--Check for match with "/some*"-->
 
             {{{ /{{lc: {{padleft:|4| {{#titleparts:{{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}|0|-1}} }} }}*
 
             {{{ /{{lc: {{padleft:|4| {{#titleparts:{{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}|0|-1}} }} }}*
             | {{{subpage| {{{other|}}} }}}  <!--Respecting empty parameter on purpose-->
+
             | <!--Check for match with "/someth*"-->
 +
              {{{ /{{lc: {{padleft:|6| {{#titleparts:{{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}|0|-1}} }} }}*
 +
              | <!--Check for match with "/somethin*"-->
 +
                {{{ /{{lc: {{padleft:|8| {{#titleparts:{{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}|0|-1}} }} }}*
 +
                | {{{subpage| {{{other|}}} }}}  <!--Respecting empty parameter on purpose-->
 +
                }}}
 +
              }}}
 
             }}}
 
             }}}
 
           }}}
 
           }}}

Revision as of 11:59, 6 November 2009