SLeepdepD

Code Snippet Wiki: MultiBoilerplate

by on Jan.30, 2011, under Programming, Technology

Just found a good solution to get around my problem of having to enter duplicate text every time I create a new snippet entry.  The MultiBoilerplate extension allows you to define different templates and then provides a drop-down to load them:

To set it up I downloaded the extension and added the following to my LocalSettings.php:

require_once( "$IP/extensions/MultiBoilerplate/MultiBoilerplate.php" );

I created the wiki page “MediaWiki:Multiboilerplate” and added the following:

* Code, VBA | Template:CodeVBA/Preload
* Code, SQL | Template:CodeSQL/Preload

This page uses the syntax “* Name | Template”.

I then created the two template pages defined above.  Here’s the VBA one:

== Description ==

== Code ==

<sh lang="vb">

</sh>

[[<noinclude>:</noinclude>Category:Code, VBA]]

Wrapping “<noinclude></noinclude>” around the colon in the catagory label will prevent this template from being included in the “Code, VBA” category, but won’t propagate the colon when the template is loaded in a snippet.

:, ,

3 Comments for this entry

Leave a Reply