Šablonas:Exists

Puslapis iš Vikižodyno, laisvojo žodyno.
Jump to navigation Jump to search

This template tests whether a given page exists. It differs from #ifexist in that the result is positive for an interwiki link.

This template is provided mainly for the purpose of backward compatibility. Consider to use #ifexist.


{{#ifexist:{{{page|{{{1}}}}}} |
  {{{then 1}}} |
  {{#ifeq: {{localurl:{{{page|{{{1}}}}}}}} | {{fullurl:{{{page|{{{1}}}}}}}} |
    {{{then|1}}} | {{{else|0}}}
  }}
}}


The full syntax for using it is:

{{exists | page=page | then=result if page exists | else=result if page does not exist }}

The parameters then and else are optional; if not given, the default values for then and else are 1 and 0 respectively. The page name may alternately be given as the first unnamed parameter, as in this short version:

{{exists | page }}

If the page name may contain equals signs, always use the "1=" or "page=" prefix.