Jump to content

Template:Search link: Difference between revisions

From Fifth Empire Wiki
fix default namespace, add comments; update recent new namespaces: gadgets
m 46 revisions imported from wikipedia:Template:Search_link
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{main other
<span class="plainlinks">[{{fullurl:Special:Search|search=<!--
| 1={{Warning|{{tl|Search link}} should not be used in [[WP:WIAA|articles]] as links to "search result pages" are among the [[WP:LINKSTOAVOID|links normally to be avoided]].}}
| 2=<span class="plainlinks">[{{fullurl:Special:Search|search=<!--
     -->{{urlencode:{{{query|{{{text|{{{1|}}}}}}}}}}}<!--  Given query  
     -->{{urlencode:{{{query|{{{text|{{{1|}}}}}}}}}}}<!--  Given query  
     -->{{#if:{{{ns|}}}{{{3|}}}
    -->{{#if:{{{limit|}}}|&limit={{{limit|}}}}}<!--
       |  <!-- either ns or 3 has a value set-->
     -->{{#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-->
         {{#if:{{{ns|}}}  <!-- is ns set? -->
         {{#if:{{{ns|}}}  <!-- is ns set? -->
         | {{#ifeq: {{{ns}}} | all    <!-- Yes. Is the value "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<!--
           -->&ns10=1&ns11=1&ns12=1&ns13=1&ns14=1&ns15=1&ns100=1&ns101=1<!--
           -->&ns10=1&ns11=1&ns12=1&ns13=1&ns14=1&ns15=1&ns100=1&ns101=1<!--
           -->&ns108=1&ns109=1&ns118=1&ns119=1&ns446=1&ns447=1&ns710=1<!--
           -->&ns118=1&ns119=1&ns710=1&ns711=1&ns828=1&ns829=1
          -->&ns711=1&ns828=1&ns829=1&ns2300=1&ns2301=1&ns2302=1&ns2303=1<!--
           | <!-- ns is set, but the value is not "all" -->
          -->&ns2600=1
           &{{lc:{{{ns}}}}}  <!-- You saw the & added, and ns argument:
           | <!-- No but ns is set to something -->
                                 ns=ns5 gives &ns5=1
           &{{lc:{{{ns}}}}}  <!-- Add the & part here, and ns argument
                                 such as to get &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 (or any other nsX) -->
         #if:{{{3|}}}  <!-- positional parameter 3 = "ns0" or other nsX -->
         | &{{lc:{{{3|}}}}}=1  
         | &{{lc:{{{3|}}}}}=1  
         }}{{
         }}{{
Line 57: Line 54:
         #if:{{{20|}}}| &{{lc:{{{20|}}}}}=1  
         #if:{{{20|}}}| &{{lc:{{{20|}}}}}=1  
         }}
         }}
       |&ns0=1<!-- Neither ns nor 3 were set.  
       |&ns0=1<!-- Neither ns nor 3-20 were set.  
         So made Template Search link's default search domain  
         So made Template Search link's default search domain  
         equal to article space;  
         equal to article space;  
Line 80: Line 77:
   -->|]|&#93;}}<!-- ] with its html symbol
   -->|]|&#93;}}<!-- ] with its html symbol
    
    
   -->]</span>
   -->]</span><!--
}}<!-- End of template main
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]]

Latest revision as of 20:49, 24 January 2026