Manual:Creating pages with preloaded text/cs
![]() | Please note: Some techniques recommended in this article require the use of extensions. Exercise caution when using them, as the status of each extension is self-assigned by its maintainer, and does not reflect the opinion of the MediaWiki development team.
Pamatujte prosím: Některé techniky doporučené v tomto článku vyžadují použití rozšíření. Při jeho používání buďte opatrní, protože stav každého rozšíření si přiděluje jeho správce sám a neodráží názor vývojového týmu MediaWiki. |
Předběžné načítání wikitextu zobrazí uživateli částečně vytvořenou stránku, případně s vloženými instrukcemi pro organizaci obsahu, namísto prázdné stránky. Tato technika je obzvláště užitečná, když wiki obsahuje jednu nebo více kategorií článků s velkým množstvím proforma textu nebo informace, které je třeba pro takové články shromáždit, jsou kombinací strukturovaných dat a volného textu. Vytváření stránek s přednačteným textem probíhá ve třech krocích:
- Navržení souboru předběžného načtení a jeho podpůrné šablony
- Vytvoření stránky pro předběžné soubory a podpůrné šablony
- Nastavení spouštěče pro načtení souboru předběžného načtení
Designing the preload file
The preload file is often an article with an embedded template. For example, if you wanted one article for each customer or marketing contact, you might want to preload text that looks something like the example below.
<!-- Please enter your customer's contact information after the equal sign. If you need help uploading the business card images, please see [[Help:Uploading business card images]] --> {{CustomerContact |Number= |BizcardImage= |Primary phone number= |Address= }}
Naming and documenting the preload file
Some extensions have specific expectations as to where the preloaded text should be stored. Others leave that decision entirely up to the system administrator.
Naming and documenting the preload file takes some care, because preload files don't always show up on "What links here" and so are at risk for accidental deletion (no info/no links—hard to tell from an article that got created and abandoned). For template based preload files, the following naming conventions may help avoid accidental deletion:
- place template in
Template:CategoryName
- place preload file in
Template:CategoryName/Preload
Loading the preload file
Preloading can be done with a preload parameter in a URL like http://en.wikipedia.org/wiki/Talk:Main_Page?action=edit§ion=new&preload=Template:Foo which links to the edit box of a new page, preloaded with Template:Foo. There are also a number of extensions available to trigger your preload file, see below.
The wikitext of the source page is preloaded into the editbox if the page or section does not exist yet. If the page or section to be edited already exists then only its wikitext is loaded, the preload command is ignored.
<noinclude>
and</noinclude>
tags are removed; if you need the preloaded text to provide noinclude tags, you can usein your source: since the two middle tags will be stripped (see next), the preloaded text will end up with just the desired<no<includeonly></includeonly>include>
<noinclude>
.- The
<includeonly>
and</includeonly>
tags are stripped from the source page. If you need the preloaded text to provide includeonly tags, you can usein your source: since the two middle tags will be stripped, the preloaded text will end up with just the desired<include<includeonly></includeonly>only>
<includeonly>
.
Thus there is neither a complete inclusion nor a regular transclusion. See also T7210 (since 2006-03-09).
If it is creating a new section, the initial content of the "Subject/headline" box can be provided with the parameter "preloadtitle"
If it is not creating a new section, the summary can be set with the summary parameter (T19002).
- http://meta.wikimedia.org/w/wiki.phtml?title=Meta:Sandbox&action=edit&summary=Doing%20some%20changes
The minor edit checkbox can be set by adding minor parameter
Using parameters
Verze MediaWiki: | ≥ 1.23 |
You can also specify parameters to the preload text with the preloadparams[]
url parameter.
(When linking on wiki, you may want to escape the []
to be %5b%5d
.)
At each insertion of the parameter[] in the URL (in order) corresponds a variable, following the numerical order: e.g. the first occurence replaces the $1
variable, the second $2
, and so on.
$1
, $2
, ... variables are distinct from {{{1}}}
, {{{2}}}
, ... variables.
In order to use preloadparams[]
, the template should use specifically the $1
, $2
, ... variables instead of {{{1}}}
, {{{2}}}
, ... parameters, which are not related to the preloadparams[] feature.
For example:
- https://mediawiki.org/wiki/Project:Sandbox?action=edit§ion=new&nosummary=true&preload=Manual:Creating_pages_with_preloaded_text/param_demo
- https://mediawiki.org/wiki/Project:Sandbox?action=edit§ion=new&nosummary=true&preload=Manual:Creating_pages_with_preloaded_text/param_demo&preloadparams%5b%5d=first%20value&preloadparams%5b%5d=second%20value
- https://mediawiki.org/wiki/Project:Sandbox?action=edit§ion=new&preload=MediaWiki:July (since MW 1.41)
Extensions
Extensions that trigger a preload file include:
- Extension:Inputbox (stable, bundled with MediaWiki) - This offers the most control over the loading process. It lets you place a button somewhere in an article, typically in a user help page or the category page corresponding to the article. You specify the name of the preload file as part of the button definition.
- Extension:NamespacePreload (stable)
- Extension:MultiBoilerplate (stable)
- Rozšíření:Page Forms (stable) - This can simply preload an article page, in addition to its form features.
- Extension:Preloader (unmaintained)
A few extensions also handle all three steps for you:
- Extension:ArticleToCategory2 (unmaintained)
All extensions related to page creation are in Kategorie:Rozšíření pro vytváření stránek .