Extension talk:Boilerplate

There seems to be a problem with boilerplate. It only puts on the page. I have a boilerplate page, like this boilerplate. I use the following software:

MediaWiki: 1.7.1 PHP: 5.1.6-pl8-gentoo (cgi-fcgi) MySQL: 5.0.26-log

The wfMsg thing doesn't work.


 * i have not tested it on 1.7.1, would be happy to take a look at your installation, as i dont have that version available. how can i contact you to help? --RouslanZenetl 20:30, 13 December 2006 (UTC)

I have the same problem. I'm using MediaWiki version 1.66

All that appears on the page is &lt;Boilerplate&gt;

Also, when I hit the 'view preview' tab, it removes all the text I had in the text box and replaces it with &lt;Boilerplate&gt;

Any ideas?

Grj 21:08, 29 December 2006 (UTC)

You have also to create a page in the ns MediaWiki with the name boilerplate ;)

but my problem is:

i want to use a template in the boilerplate, but included is not only the template, instead the source code which the template creates. how can i just get a string on my new site?

--84.141.72.146 12:06, 22 February 2007 (UTC) using mw 1.9.3

I have managed to get it to work on MediaWiki version 1.9.3 with this modified version. Rouslan, feel free to update the main page with this or clean it up as needed.

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; } ?>

147.209.216.245 03:23, 23 April 2007 (UTC)

This give me warnings like ''header already set. Ik got the óld'version to work. As mentioned above the MediaWiki:boilerplat is the page that contains the default texst. [ --Vic-- 14:55, 2 May 2007 (UTC)]

You may have some UTF8 Chars in your php Skript. Convert it to ASCII and header already set is gone. :-)

Oo.et.oO 13:15, 31 July 2008 (UTC)

I too get warnings on every mediawiki page like: Warning: Cannot modify header information - headers already sent by (output started at /var/www/localhost/htdocs/mediawiki/extensions/boilerplate.php:26) in /var/www/localhost/htdocs/mediawiki/includes/WebResponse.php on line 10

i've tried a bunch of different hacks/edits and have only ascii in boilerplate.php

does the Boilerplate page up from this discussion have the final word on what page has the actual boilerplate to transpose into the edit new page text box? thanks! Oo.et.oO

Adding a template to the boilerplate
To add a template reference such as  without the editor converting the code into the actual template contents, you need to reference a template which in turn references another template.

Updating version on main page
Updated version here in comments on 23 April 2007 works on 1.11.x as well as 1.9.x. Suggest updating the main code of this extension to reflect these changes. I will update the main code unless someone has an objection.

Testing if page exists
While testing this extension with our global MediaWiki configuration we experienced the problem, that some wikis didn't have MediaWiki:Boilerplate. What about testing if it exists before inserting the text of it? Best regards, --Flominator 07:51, 22 May 2008 (UTC)

Problems with the user namespace?
Have you ever faced problems with the boilerplate extension on the user pages? In our wiki we would like to encourage all our members to have similar formatting in their user pages and that is one of the reason we installed the boilerplate extension. But it seems that for some reason on these pages the extension won't work. We are currently using this extension succesfully in almost 10 different namespaces and only the user namespace isn't working. Any ideas why this is the case?
 * The Extension supports only one namespace. If you want more namespaces e.g. with different templates use the Extension:PreloadManager

--Ozz 16:42, 4 June 2008 (UTC)
 * Thank you for the quick response!

Boilerplate for Namespaces
I have made some modifications to the Boilerplate script in order to be able to handle multiple Namespaces

 'BoilerPlateSelection',         'author' => 'David Tod Sigafoos (based on work by RouslanZenetl)',        'url' => 'http://www.mediawiki.org/wiki/Extension:BoilerPlateSelection',        'description' => 'Create new pages based on new page title' ); /** * Set up hooks for discussion threading * * @param $wgBoilerPlateAry global array of Title key words and associated templates */ $wgHooks['EditPage::showEditForm:initial'][] = array('boilerplateselection'); function boilerplateselection($editpage) { // EditFormPreloadText global $wgOut; global $wgBoilerPlateAry; global $wgBoilerPlateNamespacesAry; global $wgCanonicalNamespaceNames;
 * 1)     get out if not part of mediawiki ..

$wgOut->enableClientCache(false); //       be sure that our var has been set else just default behavior if ( !isset($wgBoilerPlateAry) ) { $wgBoilerPlateAry = ''; }   if ( !isset($wgBoilerPlateNamespacesAry) ) { $wgBoilerPlateNamespacesAry = ''; }

$boilerPlateArticle = '';

if (!$editpage->preview        && !$editpage->mArticle->mContentLoaded         && $wgBoilerPlateNamespacesAry[$editpage->mArticle->mTitle->mNamespace]) { // get the Namespace Name $bpnsName = $wgCanonicalNamespaceNames[$editpage->mArticle->mTitle->mNamespace]; //   set default for article $boilerPlateArticle = 'Boilerplate'; //   get the title for the current article $articleTitle = $editpage->mArticle->mTitle->getText; // loop through the array to find 'Key Word' in the array and // associated template name // 22aug07   dsig    modified to drop out of foreach when a target found $flgFound = false; if (is_array( $wgBoilerPlateAry )) { foreach ($wgBoilerPlateAry as $bpKey => $bpValue) { if ( !$flgFound ) { if ( eregi($bpKey, $articleTitle) ) { $boilerPlateArticle = $bpValue; $flgFound = true; } elseif (strcmp(substr($bpKey,0,strlen($bpnsName. ":")),$bpnsName. ":") == 0) {                       $cmp = substr($bpKey,strlen($bpnsName. ":"));                       if (strlen($cmp) > 0 && eregi($cmp, $articleTitle) ) { $boilerPlateArticle = $bpValue; $flgFound = true; } else { $boilerPlateArticle = $bpValue; $flgFound = true; }                   }                }            }        }

/*               boilerPlateArticle is the associated name with the current title. 'Boilerplate' is the default "NO HIT" which will cause a blank page to be displayed. */       $boilerplate_title = Title::newFromText('Template:' . $boilerPlateArticle); $boilerplate_article = new Article($boilerplate_title); $editpage->textbox1=$boilerplate_article->GetContent; $editpage->textbox2=$editpage->textbox1; }              return true; } ?>

This allows for having a standard User template for new users to fill out, along with support for your other custom Namespaces LocalSettings.php: global $wgBoilerPlateAry; $wgBoilerPlateAry = array('Sandbox' => 'Boilerplate',                         'fix' => 'Fixes',                          'MyNS:stuff' => 'MyNS_Stuff', // searches for "stuff" in "MyNS"                          'User:' => 'User' // This is for all new pages in this Namespace                          ); global $wgBoilerPlateNamespacesAry; $wgBoilerPlateNamespacesAry = array(NS_MAIN => true,                                   NS_TALK => true,                                    NS_USER => true                                    );

Also, need to note that things like FckEditor need to be added AFTER Boilerplate, otherwise newlines get severely destroyed. Things like NamespacePermissions need to be included before the Boilerplate.

07:00, 29 September 2008 (UTC) - Chris Bennett