Extension:BoilerplateSelection

Version
0.1 first release

0.2 Setting flag during foreach. This causes the process to use first hit as the template to use

0.3 made search case insensitive

What can this extension do?
This extension, based on the original work by User:RouslanZenetl, Extension:Boilerplate, was written to allow use of various Boilerplates based on the articles title.

We are documenting various functions of our system. We want predefined Boilerplate templates used but don't want the user to have to cut/paste the 'template' into a blank page. There are 'User Request', 'Technical Design', 'Functional Design' 'Data Design' and 'Scope' documents (templates). We have defined that articles of these types will have titles like '999 Purchasing Request' or '999 Make Wiki Better Functional'. So we add 'keyword' trigger to the title.

Boilerplateselection depending on article title, will be retrieved on any NEW page and presented to the user in edit mode.

If the user is creating a page which we have no Boilerplate for, we will create a new page using the default Boilerplate template.

Usage
Once installed simply create Boilerplate templates. To create a template, simply create a page titled "Template:{0}" where {0} is the name of your page template. So, to create the CopyBooks template below, you need to create a page with a title of "Template:CopyBooks". And, to create the default template that is used when no matches are found, create a page called "Template:Boilerplate".

Then modify $wgBoilerPlateAry as needed. One thing to keep in mind is the order of your key words in the array. An Example

The process looks at each of the array elements[1] and tries to find a match in the article title. If you have a page with title 'Data Analysis' the process will find it last and try to get the template 'DataAnalysis'. If you had a page called 'Technical Review of Data Analysis' it will find Technical first and use that as your seed.

Installation

 * Create a the directory Boilerplateselection in your extensions folder. Then copy/paste the code into Boilerplateselection.php in that folder.
 * Make noted changes to LocalSettings.php
 * Create template Boilerplate and copy this code as the default 'new page'
 * Modify $wgBoilerPlateAry in LocalSettings.php to match your new article keywords and associated boilerplate templates

Parameters
none

Boilerplate Template
If wgBoilerPlateAry is not defined or you have not used a name the process recognizes then the default is 'Boilerplate' template. This is an example of the template we use.