Extension talk:NewArticleTemplates

From MediaWiki.org
Jump to: navigation, search

Contents

[edit] article and user page templates

i want two custom templates...it works for the article...but how to add USER PAGE namespace? $wgNewArticleTemplatesNamespaces = array(

       NS_MAIN                 => 1,
       100                     => 1,
       102                     => 1,
       104                     => 1,
       106                     => 1,

       NS_USER                 => 2,
       100                     => 2,
       102                     => 2,
       104                     => 2,
       106                     => 2

);

  1. new pages in the main namespace use MediaWiki:NewArticleTemplate:

$wgNewArticleTemplates_PerNamespace = array(

       NS_MAIN                 => "MediaWiki:NewArticleTemplate",
       NS_USER                 => "MediaWiki:NewArticleTemplateUser",

);


[edit] Preloader for Image/Media Upload

Does the extension work with NS_IMAGE? Thank you for any replying. :-) --Roc michael 22:59, 11 May 2008 (UTC)

Oo.et.oO 18:35, 12 August 2008 (UTC):
Hi Roc michael,
I added:
         NS_IMAGE                => 1,
to $wgNewArticleTemplatesNamespaces and it works... kinda. when adding an article named "Image:fake_test.jpg" the article used the template specified (in this case : $wgNewArticleTemplatesDefault). Of course after the article creation it says that no such file exists.
However, using the "Upload file" link in the toolbox does not use the template.
i might also find that useful if i need users to always put certain markup in the "summary".
where would you have the template add the preload markup? in the "summary" box?
anyone else have comments on how it would work with upload file?

[edit] Download error

Hi Mati, When I tried to download the extension, I will see the following message:

Not Found
The requested URL /mediawiki/trunk/NewArticleTemplates was not found on this server.
Oo.et.oO 18:09, 12 August 2008 (UTC): works for me using both the download http link as well as subversion.

[edit] merging of extensions?

I'm the author of the extension described on the subject-page. The See-Also chapter had this added:

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

I skimmed through the other extensions and couldn't find much functionality that is not provided by this extension. If there is functionality that would be "nice to have" in this extension and exists in other extensions, I'm happy to integrate them here - so please post suggestions here. It would also be ok to move it to the MediaWiki SVN, if the MediaWiki-team would like that. Let me know what you think! -- Mati 11:14, 12 October 2008 (UTC)


[edit] You have a error in you PHP code

       NS_MAIN                 => "MediaWiki:NewArticleTemplate",

should be

       NS_MAIN                 => "MediaWiki:NewArticleTemplate"
actually, thats not an error. PHP accepts the coma after the last element in an array. This eases code-maintenance, i.e. consider this:
$arr = array (
    "first" => 1,
    "second" => 2,
    "third" => 3,
); # to err is human, to arr is pirate!
In this code, you can safely add another line at the end and the code still works. If you comment the last line out, again, there is no problem with php. -- Mati 17:33, 12 November 2008 (UTC)

[edit] Quick & Dirty patch to add page's name to the template

Thanks for the great extension! I needed a way to put the new page's name into the template text (I'm calling another template that uses {{PAGENAME}} in a comparison) and I couldn't see any obvious way to do this, so I made a very quick patch:

Index: NewArticleTemplate.php
===================================================================
--- NewArticleTemplate.php    (revision 328)
+++ NewArticleTemplate.php    (working copy)
@@ -79,8 +79,9 @@
                                $template = $template . '/Subpage';
                        }
                }
-
-             $newPage->textbox1 = preload( $template );
+             $templateText = preload( $template );
+             $templateText = str_replace("__PAGENAME__", $title->getText(), $templateText);
+             $newPage->textbox1 = $templateText;
 #                      $newPage->textbox1 = preload($wgNewArticleTemplatesDefault);
        }
        return true;

This can be easily modified to mangle the text in any way you please.

Danielsoneg 01:16, 27 February 2010 (UTC)

[edit] How can i make this extension working for Categories ?

Hi,

I'm a newbie in mediaWiki and i need such that extension for customizing special categories like Category:People or Category:Book. is it possible to use this extension for that kind ?

Thank's in advance for any reply

Personal tools
Namespaces
Variants
Actions
Site
Support
Download
Development
Communication
Print/export
Toolbox