What to do when I want dynamic inclusion in Main namespace?

35 views
Skip to first unread message

AdSvS

unread,
Mar 7, 2013, 11:53:26 AM3/7/13
to mediawiki-page-a...@googlegroups.com
Hi,

I only want attachements in certain categories and not on all pages of Main namespace.
Added $wgPageAttachment_allowedNameSpaces[] = ''; to SiteSpecificConfigurations.php but that didn't work. 
Then I changed the statement in DefaultConfigurations.php to the same, but that doesn't work either. 
Still get attachements everywhere.
What can I do to have dynamic inclusion in Main namespace?

Thanks!
Ad
 

Aldrin

unread,
Mar 8, 2013, 5:52:02 AM3/8/13
to mediawiki-page-a...@googlegroups.com
Hi Ad:

First, to remove all allowed namespaces, add the following line in the SiteSpecificConfigurations.php file:

unset($wgPageAttachment_allowedNameSpaces);


The reason being, the way PHP works is that when you do the following, you are actually adding new values to the array and not clearing the existing values.

$wgPageAttachment_allowedNameSpaces[] = '';


Second, suppose you want the pages in category "DOCS" to have attachments, then add the following line in the configuration file:

$wgPageAttachment_allowedCategories[] = 'DOCS';


Third, to allow specifying dynamically which pages should have attachments by adding "__ATTACHMENTS__" token in the page, add the following line to the configuration file:

$wgPageAttachment_allowAttachmentsUsingMagicWord = true;


Fourth, in case you want to change __ATTACHMENTS__ token to something else, perhaps to __AA__ to shorten the token to mean "Allow Attachments" then add the following line to the configuration file:

$wgPageAttachment_magicWordToAllowAttachments = '__AA__';


Let me know if the foregoing resolve your issues.

Sincerely yours,

Aldrin
Reply all
Reply to author
Forward
0 new messages