From MediaWiki.org
Jump to navigation Jump to search
This page is a translated version of the page Extension:IfTemplates and the translation is 17% complete.

Other languages:
Deutsch • ‎English • ‎català • ‎español • ‎italiano • ‎polski • ‎português • ‎português do Brasil • ‎sicilianu • ‎suomi • ‎中文 • ‎日本語
Manual de extensões do MediaWikiManual:Extensions
Crystal Clear action run.svg

Estado da versão:Extension status beta

ImplementaçãoTemplate:Extension#type Parser function
DescriçãoTemplate:Extension#description Tests if a given page contains only template calls
Autor(es)Template:Extension#username Ike Hecht (tosfostalk)
Última versãoTemplate:Extension#version 0.1 (2014-05-22)
MediaWikiTemplate:Extension#mediawiki > 1.21, likely earlier versions as well
PHPTemplate:Extension#php 5.3+
Alterações à
base de dados
LicençaTemplate:Extension#license GPL
Exportação (Download)
Hooks usadosTemplate:Extension#hook

Traduza a extensão IfTemplates se ela estiver disponível na wiki translatewiki.net

Verifique a matriz de utilização e versões

The IfTemplates extension adds a parser function that tests if a given page contains only template calls. This can have a number of uses. For example, in your wiki you may be able to make the assumption that any pages that only contain template calls are stubs with no real content.


  • Exporte e coloque o ficheiro, ou ficheiros, num diretório chamado IfTemplates, na sua pasta extensions/.
  • Acrescente o seguinte código ao fundo do ficheiro LocalSettings.php:
    require_once "$IP/extensions/IfTemplates/IfTemplates.php";
  • YesY Pronto – Na página especial Special:Version da sua wiki verifique se a extensão foi instalada.


The extension's usage is similar to the #ifexist parser function. It takes an input string, interprets it as a page title, and returns one of two values depending on whether or not the page contains only templates.

{{#iftemplates: page title | value if only templates | value if doesn't exist or has non-template text }}

The function evaluates to true if the page exists & contains only templates. Otherwise it evaluates to false. Note that if the page exists but contains no template calls, it evaluates to false.

Aviso Aviso: This is an expensive parser function and may not function correctly if called too many times on one page.Please see this page for more information.