మూస:does-template-exist
- The following documentation is located at Template:does-template-exist/doc. [edit]
- Note: Please move the documentation subpage to Template:does-template-exist/documentation.
This template is a total hack around the fact that MediaWiki considers #ifexist: to be an expensive parser function, and therefore limits the number of times it can be used on a page. This is somewhat reasonable — detecting whether a page exists is, in fact, much more expensive than evaluating a simple parser-function like #if: and #switch: — but on the other hand, this is something that MediaWiki does all the time, whenever a page contains a link or includes a template or belongs to a category (since MediaWiki has to distinguish redlinks from bluelinks, and also hidden categories from regular ones — let alone all the overhead of actually including a template). So, while #ifexist: should not be overused, there are a few use-cases where it really does make sense to test if a page exists, and where MediaWiki's restriction really is not reasonable. If your use-case meets the requirements in the box above, then this template is for you.
Usage[<small>మార్చు</small>]
This:
{{#if:{{does-template-exist|foobar}}|yes|no}}
produces yes if {{foobar}} exists, and no if it does not.
It may also be substituted:
{{subst:#if:{{subst:does-template-exist|foobar}}|yes|no}}
See also[<small>మార్చు</small>]
- {{#ifexist:...}}