Last modified: 2010-05-15 15:28:10 UTC
This patch enables support for the use of Templates for New Articles. It does check if it is a New Article (and not a preview) and can be enabled/disabled in LocalSettings.php. This is a diff from my local CVS wiki (original version) to the installed one. RCS file: /usr/cvs/wiki/includes/EditPage.php,v retrieving revision 1.1.1.1 diff -r1.1.1.1 EditPage.php 404a405,418 > > $articletemplate = ''; > /* Checking if its a new article and it is not a preview */ > if(!$this->mTitle->getArticleID() && $formtype ! = 'preview'){ # new article > /* > * Yes, it is a new article. > * Checking if should get data from template and if template file exists > */ > global $wgUseArticleTemplate; > global $wgArticleTemplateFile; > if($wgUseArticleTemplate && is_readable ($wgArticleTemplateFile)){ > $articletemplate = implode('', file ($wgArticleTemplateFile)); > } > } 412c426 < htmlspecialchars( $wgLang->recodeForEdit( $this- >textbox1 ) ) . --- > htmlspecialchars( $wgLang->recodeForEdit( $articletemplate . $this->textbox1 ) ) . 424a439 > unset($articletemplate); --- RCS file: /usr/cvs/wiki/LocalSettings.php,v retrieving revision 1.2 diff -r1.2 LocalSettings.php 102a103,105 > > $wgUseArticleTemplate = true; > $wgArticleTemplateFile = 'templates/templatetoedit.txt'; Above are the entries used in LocalSettings.php. $wgUseArticleTemplate is a boolean (true/false) which enables/disables the support for Article Templates usage. $wgArticleTemplateFile is the file which will be automaticly loaded in New Article's textarea edition space. I hope this helps somebody. :)
*** Bug 1259 has been marked as a duplicate of this bug. ***
Is there a way to include the template in the database?
See also the slightly different solution at bug 2286 *** This bug has been marked as a duplicate of 2286 ***