[Mediawiki-l] New wiki global: $wgOpenExternalLinkInNewWindow

Hugh Prior mediawiki at localpin.com
Sat Jul 8 10:58:39 UTC 2006


Dunno who to suggest this to, but this seems like a high value, low work 
improvement to MediaWiki (excuse me if it has already been added - I'm back 
on 1.5.7).  Say "aye" if you think it is a good idea.  Suggest alternate 
names for the variable if you think this one sucks.


Hugh


in DefaultSettings.php add:

/** Set to true to open external links in a new window
$wgOpenExternalLinkInNewWindow = false;



in */includes/linker.php*

function getExternalLinkAttributes
...
After

$r = ($class != '') ? " class='$class'" : " class='external'";

add the following code:

global $wgOpenExternalLinkInNewWindow;
if ($wgOpenExternalLinkInNewWindow) {
    $r .= " target=\"_blank\"";
}






More information about the MediaWiki-l mailing list