Extension:Boilerplate
From MediaWiki.org
|
Release status: unknown |
|||
|---|---|---|---|
| Implementation | Page action | ||
| Description | Load boilerplate text for a brand new page. | ||
| Author(s) | User:RouslanZenetl | ||
| Last Version | 0.0.3 (2007-11-04) | ||
| MediaWiki | 1.6.8 - 1.11.0 | ||
| License | GPL v3 | ||
| Download | Download and Installation | ||
|
|||
|
check usage (experimental) |
|||
- Note: Several users have reported bugs with this extension related to unmodifiable headers, please see the discussion tab for details. There are a few other extensions which may or may not offer the same functionality but are more up to date with recent versions of media wiki.
Contents |
[edit] Introduction
This extension loads pre-defined text (from a page named Boilerplate that you create on your MediaWiki site) when a brand new page is created.
[edit] Download and Installation
Step 1: Copy-paste this code into a file boilerplate.php and place it in extensions directory.
<?php $wgHooks['EditPage::showEditForm:initial'][] = array('boilerplate'); $wgExtensionCredits['other'][] = array( 'name' => 'Boilerplate', 'author' => '[http://rouslan.zenetl.com/ RouslanZenetl]', 'description' => 'loads pre-defined text from [[MediaWiki:Boilerplate]] when a brand new page is created', 'url' => 'http://www.mediawiki.org/wiki/Extension:Boilerplate' ); function boilerplate($editpage) { // EditFormPreloadText global $wgOut; $wgOut->enableClientCache(false); if (!$editpage->preview && !$editpage->mArticle->mContentLoaded && $editpage->mArticle->mTitle->mNamespace==0) { $boilerplate_title = Title::newFromText('boilerplate'); $boilerplate_article = new Article($boilerplate_title); $editpage->textbox1=$boilerplate_article->GetContent(); $editpage->textbox2=$editpage->textbox1; } return true; } ?>
Step 2: Add the following line to LocalSettings.php:
require_once("$IP/extensions/boilerplate.php");
Step 3: Create a page named Boilerplate on your MediaWiki site. Whatever is included in this Boilerplate page will serve as the default template for any new pages created on your site.
Thats it!
[edit] License
[edit] See Also
- Extension:MultiBoilerplate
- Extension:Preloader provides per-namespace preload text
- Extension:PreloadManager provides per-namespace preload text
- Extension:HeaderFooter provides per-namespace header/footer text
- Extension:NewArticleTemplates provides per-namespace preload text
perhaps Extension:Preloader, Extension:PreloadManager, Extension:NewArticleTemplates and Boilerplate should be merged?