
- #MEDIAWIKI PARSER FUNCTIONS FULL#
- #MEDIAWIKI PARSER FUNCTIONS CODE#
Change the name of your parser function!.
(optional, for now) Edit the "credits" line. So the line that starts with $GLOBALS should be changed to reflect your parser functions name. Parser functions specific to Semantic MediaWiki are: parser functions for semantic annotations set subobject setrecurringevent declare parser functions for inline queries ask show other concept (used to story query results. The function you define in the previous step needs to have a file associated with it, and you need to tell MediaWiki to "autoload" it. In BasicParserFunction it is "BasicParserFunction\SubstrCount", but another example could be "MyParserFunction\DoImportantFunction". The variable $GLOBALS can be changed to whatever your parser function should be called. Edit three lines in BasicParserFunction.php:. i18n/es.json: Just like en.json, but Spanish instead of English. i18n/en.json: Internationalization file, specifying what text should be displayed if you're using the English version of a wiki. SubstrCount.php: This is the meat of your parser function, where the logic is handled. Magic.php: Defines the name of your parser function(s). BasicParserFunction.php: The "entry point" for your extension, where everything is setup for MediaWiki. View the 6 files in your extension (this tutorial assumes you kept it called "BasicParserFunction"):. You can skip this step initially if you are just learning and don't mind leaving your extension called "BasicParserFunction". Also, throughout the extension the name "BasicParserFunction" is used in many places. Rename your new BasicParserFunction directory to whatever you want your extension to be called. Copy the BasicParserFunction extension code from and put the files in your wiki's extension directory.I haven't had time to figure out what's still applicable. Creating your own extension (old instructions)īelow are old instructions. Then add your new extensions to LocalSettings.php with wfLoadExtension('YourExtensionName').
Php createParserFunction.php -ext-name=MyNewExtension -function=my-parser-function -your-name="Your Full Name"Ī new extension will be generated at /path/to/your/mediawiki/extensions/MyNewExtensionĮdit /path/to/your/mediawiki/extensions/MyNewExtension/includes/.php to do what you want.