Template:Search link: Difference between revisions
Appearance
improve the way it defaults even more: any of the 17 positional parameters can avoid a default |
remove mainspace restrictions, per wt:External links; add a new limit parameter to specify how many search results are wanted |
||
| Line 1: | Line 1: | ||
<span class="plainlinks">[{{fullurl:Special:Search|search=<!-- | |||
-->{{urlencode:{{{query|{{{text|{{{1|}}}}}}}}}}}<!-- Given query | -->{{urlencode:{{{query|{{{text|{{{1|}}}}}}}}}}}<!-- Given query | ||
-->{{#if:{{{limit|}}}|&limit={{{limit|}}}}}<!-- | |||
-->{{#if:{{{ns|}}} {{{3|}}} {{{4|}}} {{{5|}}} {{{6|}}} {{{7|}}} {{{8|}}} {{{9|}}}{{{10|}}} {{{11|}}} {{{12|}}} {{{13|}}} {{{14|}}} {{{15|}}} {{{16|}}} {{{17|}}} {{{18|}}} {{{19|}}} {{{20|}}} | -->{{#if:{{{ns|}}} {{{3|}}} {{{4|}}} {{{5|}}} {{{6|}}} {{{7|}}} {{{8|}}} {{{9|}}}{{{10|}}} {{{11|}}} {{{12|}}} {{{13|}}} {{{14|}}} {{{15|}}} {{{16|}}} {{{17|}}} {{{18|}}} {{{19|}}} {{{20|}}} | ||
| <!-- either ns or 3-20 has a value set--> | | <!-- either ns or 3-20 has a value set--> | ||
{{#if:{{{ns|}}} <!-- is ns set? --> | {{#if:{{{ns|}}} <!-- is ns set? --> | ||
| {{#ifeq: {{{ns}}} | all <!-- | | {{#ifeq: {{{ns}}} | all <!-- ns is set. Is the value "all"? | ||
-->| <!-- True, the value of ns is "all" --> | -->| <!-- True, the value of ns is "all" --> | ||
&ns0=1&ns1=1&ns2=1&ns3=1&ns4=1&ns5=1&ns6=1&ns7=1&ns8=1&ns9=1<!-- | &ns0=1&ns1=1&ns2=1&ns3=1&ns4=1&ns5=1&ns6=1&ns7=1&ns8=1&ns9=1<!-- | ||
| Line 13: | Line 12: | ||
-->&ns711=1&ns828=1&ns829=1&ns2300=1&ns2301=1&ns2302=1&ns2303=1<!-- | -->&ns711=1&ns828=1&ns829=1&ns2300=1&ns2301=1&ns2302=1&ns2303=1<!-- | ||
-->&ns2600=1 | -->&ns2600=1 | ||
| <!-- | | <!-- ns is set, but the value is not "all" --> | ||
&{{lc:{{{ns}}}}} <!-- | &{{lc:{{{ns}}}}} <!-- You saw the & added, and ns argument: | ||
ns=ns5 gives &ns5=1 | |||
Use {{lc:}} not only to lower case, | Use {{lc:}} not only to lower case, | ||
but also to strip away whitespace --> | but also to strip away whitespace --> | ||
}} | }} | ||
}}{{ | }}{{ | ||
#if:{{{3|}}} <!-- 3 = ns0 | #if:{{{3|}}} <!-- positional parameter 3 = "ns0" or other nsX --> | ||
| &{{lc:{{{3|}}}}}=1 | | &{{lc:{{{3|}}}}}=1 | ||
}}{{ | }}{{ | ||
| Line 80: | Line 79: | ||
-->|]|]}}<!-- ] with its html symbol | -->|]|]}}<!-- ] with its html symbol | ||
-->]</span> | -->]</span><!-- | ||
Output a hidden category: -->{{#if: {{{ns|}}}{{{3|}}}{{{4|}}}{{{5|}}}{{{6|}}}{{{7|}}}{{{8|}}}{{{9|}}}{{{10|}}}{{{11|}}}{{{12|}}}{{{13|}}}{{{14|}}}{{{15|}}}{{{16|}}}{{{17|}}}{{{18|}}}{{{19|}}}{{{20|}}} | Output a hidden category: -->{{#if: {{{ns|}}}{{{3|}}}{{{4|}}}{{{5|}}}{{{6|}}}{{{7|}}}{{{8|}}}{{{9|}}}{{{10|}}}{{{11|}}}{{{12|}}}{{{13|}}}{{{14|}}}{{{15|}}}{{{16|}}}{{{17|}}}{{{18|}}}{{{19|}}}{{{20|}}} | ||
| [[Category:Search link templates with namespace parameters]] | | [[Category:Search link templates with namespace parameters]] | ||
Revision as of 23:38, 29 January 2016
File:Test Template Info-Icon - Version (2).svg Template documentation[create] [purge]