Extension:AutoCreatePage

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
AutoCreatePage

Release status:Extension status beta

ImplementationTemplate:Extension#type Parser function
DescriptionTemplate:Extension#description Provides a parser function to create additional pages automatically when a page is saved
Author(s)Template:Extension#username Markus Krötzsch
Latest versionTemplate:Extension#version 0.6 (2016-10-13)
MediaWikiTemplate:Extension#mediawiki 1.21.0 or higher
PHPTemplate:Extension#php 5.3 or above
Database changesTemplate:Extension#needs-updatephp No
LicenseTemplate:Extension#license GNU General Public License 2.0 or later
Download
README
ParametersTemplate:Extension#parameters
  • $egAutoCreatePageMaxRecursion
  • $egAutoCreatePageIgnoreEmptyTitle
  • $egAutoCreatePageNamespaces
Hooks usedTemplate:Extension#hook
ParserFirstCallInitManual:Hooks/ParserFirstCallInit
ArticleEditUpdatesManual:Hooks/ArticleEditUpdates

Translate the AutoCreatePage extension if it is available at translatewiki.net

Check usage and version matrix.

The AutoCreatePage extension provides a parser function createpageifnotex that creates a page of a given title if no such page exists yet. The function takes the page title and the wikitext that is used to create the page as its only parameters. This can be used by templates that want to create some content on separate pages, which is especially useful when creating pages with Semantic Forms or when using Semantic MediaWiki to create query pages (which may be too big to fit on the same page).

Usage and documentation[edit]

Documentation is found on the github page of the extension. The general syntax for using the parser function is:

{{#createpageifnotex:Name of the page to create|Initial content of the page if created}}

All newly created pages will be attributed to the user who edited the page where the parser function was used. It is possible to use templates and parser functions as part of the initial content by surrounding them with <nowiki> tags. However, newly created pages can never create additional pages (this is a feature; otherwise one could accidentally create large numbers of pages, where each new page creates another one).

Requirements[edit]

AutoCreatePage requires:

Download and installation[edit]

The source code of the initial release is found at github: https://github.com/mkroetzsch/AutoCreatePage. To install the extension, you need to download the code to your MediaWiki extension directory. An easy way to do this is to run the following command from you extension directory:

git clone https://github.com/mkroetzsch/AutoCreatePage.git

but there are also file-based downloads if you don't have git installed. Once you have downloaded the code, with the AutoCreatePage directory within your MediaWiki 'extensions' directory, add the following code to your LocalSettings.php file:

# AutoCreatePage
require_once "$IP/extensions/AutoCreatePage/AutoCreatePage.php";

Version[edit]

  • Version 0.4 (2014-9-23): Initial release, based on previous code by Daniel Herzig (from AIFB Portal extension version 0.3).

Internationalization[edit]

AutoCreatePage is not currently internationalized. There are only three string messages in the code, so you could add the appropriate i18n files if needed. A repository should be created in Gerrit and the code be moved there to get full translatewiki.net support (please notify the author if you do this, so suitable links can be added to the original github repository to avoid confusion as to where the most current code lives).

Authors[edit]

AutoCreatePage has been written by Markus Krötzsch, based on code by Daniel Herzig.