Jump to content

Extension:PageInCat: Difference between revisions

From mediawiki.org
Content deleted Content added
No edit summary
Line 39: Line 39:
This extension adds a parser function that is similar to the <nowiki>{{#ifexist:...}}</nowiki> function from [[extension:ParserFunctions]]. It works as follows <code><nowiki>{{#incat:Some category|what to do if current page is in category|what to do if current page is not in category}}</nowiki><code>. It also suports #incategory, #ifpageincat and #ifpageincategoy.
This extension adds a parser function that is similar to the <nowiki>{{#ifexist:...}}</nowiki> function from [[extension:ParserFunctions]]. It works as follows <code><nowiki>{{#incat:Some category|what to do if current page is in category|what to do if current page is not in category}}</nowiki><code>. It also suports #incategory, #ifpageincat and #ifpageincategoy.


{{warning|This extension doesn't work properly during preview. Once the page is saved everything works fine, but before page save, it will use whatever category}}
{{warning|This extension doesn't work properly during preview. Once the page is saved everything works fine, but before page save, it will use whatever categories were in the article on the previous revision}}


==Download instructions==
==Download instructions==

Revision as of 08:13, 19 December 2011


MediaWiki extensions manual
PageInCat
Release status: stable
Implementation Parser function
Description Adds a parser function to test if the current page is in some category
Author(s) Bawolfftalk
Latest version 1
MediaWiki >= 1.45.0
  • $wgPageInCatUseAccuratePreview
Licence GPLv2
Download
Translate the PageInCat extension if it is available at translatewiki.net

What can this extension do?

This extension adds a parser function that is similar to the {{#ifexist:...}} function from extension:ParserFunctions. It works as follows {{#incat:Some category|what to do if current page is in category|what to do if current page is not in category}}. It also suports #incategory, #ifpageincat and #ifpageincategoy.

Warning Warning: This extension doesn't work properly during preview. Once the page is saved everything works fine, but before page save, it will use whatever categories were in the article on the previous revision

Download instructions

Installation

Download thingy, put it in appropriate place in extensions directory, add line require_once( "$IP/extensions/PageInCat/PageInCat.php" ); to bottom of LocalSettings.php

Note, this will probably work for MediaWiki versions before 1.19 (provided its not super ancient), eventhough the download link only has a version for MediaWiki 1.19. If in doubt, try it out and see if it works with your version.

Configuration parameters

This extension doesn't have any configuration parameters. However, the number of times you can use #incat on a page is limited by $wgExpensiveParserFunctionLimit (defaults to 100, which should be fine for most folks). Calling #incat twice on the same page for the same category only counts once towards the expensive function limit.

See also