Extension:Boilerplate

From MediaWiki.org
Jump to: navigation, search
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.
MediaWiki extensions manual - list
Crystal Clear action run.png
Boilerplate

Release status: experimental

Implementation Page action
Description Loads boilerplate text for a brand new page.
Author(s) Rouslan Zenetl (RouslanZenetltalk)
Last version 0.0.3 (2007-11-04)
MediaWiki 1.6.8 - 1.11.0
Database changes no
License GPL v3
Download Download and Installation
Hooks used
EditPage::showEditForm:initial
Check usage and version matrix

The Boilerplate extension loads pre-defined text (from a page named Boilerplate that you create on your MediaWiki site) when a brand new page is created.

Download and Installation [edit]

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]',
        'version' => '0.0.3',
        'description' => 'Loads pre-defined text from [[MediaWiki:Boilerplate]] when a brand new page is created',
        'url' => 'https://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!

License [edit]

GPL v3

See Also [edit]

perhaps Extension:Preloader, Extension:PreloadManager, Extension:NewArticleTemplates and Boilerplate should be merged?