Extension:AutoCreatePage
AutoCreatePage Release status: stable |
|
---|---|
Implementation | Parser function |
Description | Provides a parser function to create additional pages automatically when a page is saved |
Author(s) |
|
Maintainer(s) | Universal Omega |
Latest version | 0.9 (2022-08-19) |
MediaWiki | 1.36+ |
PHP | 7.3+ |
Database changes | No |
License | GNU General Public License 2.0 or later |
Download | GitHub: README |
|
|
Quarterly downloads | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Public wikis using | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
The AutoCreatePage extension provides a parser function called #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 Page Forms or when using Semantic MediaWiki to create query pages (which may be too big to fit on the same page).
Usage
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. Example:
{{#createpageifnotex:
Name of the page to create
|<nowiki>{{TemplateName|parameter=value}}</nowiki>
}}
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).
Installation
- <translate> <tvar name=1>Download, extract</tvar> and place the file(s) in a directory called <tvar name=name>
AutoCreatePage
</tvar> in your <tvar name=ext>extensions/
</tvar> folder.</translate> - <translate> Add the following code at the bottom of your <tvar name=1>LocalSettings.php </tvar> file:</translate>
wfLoadExtension( 'AutoCreatePage' );
- Configure as required.
- File:OOjs UI icon check-constructive.svg <translate> Done</translate> – <translate> Navigate to <tvar name=special>Special:Version</tvar> on your wiki to verify that the extension is successfully installed.</translate>
Configuration
The extension supports three configuration variables, that can be set in the "LocalSettings.php" file.
$egAutoCreatePageMaxRecursion
- The maximum recursion depth to which calls of createpageifnotex are executed on created pages. Default:
1
. $egAutoCreatePageIgnoreEmptyTitle
- If invocations of createpageifnotex should be silently ignored. Default:
false
(will put an error message on the wiki page). $egAutoCreatePageNamespaces
- The list of namespaces in which calls of createpageifnotex are executed. If your call originates from a page not in one of these namespaces, it gets ignored. Defaults to $wgContentNamespaces . An example for an alternative setting:
$egAutoCreatePageNamespaces = [ NS_MAIN, NS_USER, NS_TEMPLATE, NS_CUSTOM ];
See also
- Extension:Create Page - Allows placing an input that takes the name of a new page into pages.
- Extension:InputBox - Allows users to add predefined HTML forms to wiki pages
- Extension:CreatePageUw - Adds a form via a special page to create a new page
File:OOjs UI icon information-progressive.svg | <translate> This extension is included in the following wiki farms/hosts and/or packages:</translate>
<translate> This is not an authoritative list.</translate> <translate> Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here.</translate> <translate> Always check with your wiki farms/hosts or bundle to confirm.</translate> |
- Pages with script errors
- Pages with syntax highlighting errors
- Pages with broken file links
- Stable extensions
- Extensions without an image
- Parser function extensions
- Extensions without a compatibility policy
- Extensions with manual MediaWiki version
- GPL licensed extensions
- Extensions in GitHub version control
- ParserFirstCallInit extensions
- RevisionDataUpdates extensions
- All extensions
- Extensions not in ExtensionJson
- Page creation extensions