php - Add tab and open in new window/tab -


i´ve searched possibillity add tabs next page , discussion , found below. link post below code

$wghooks['skintemplatenavigation'][] = 'replacetabs'; function replacetabs( $skin, &$links) {       $links['namespaces']['name_of_tab'] = array(             'class' => false or 'selected', // if tab should highlighted             'text' => 'text_of_tab', // tab says             'href' => 'url_to_point_to', // links             'context' => 'main',     );     return true; } 

it works great windows opened in same window. have added $wgexternallinktarget = '_blank'; seems not working these link (works other external links i´m have on wiki).

is there way force tab links open in new window or tab?

i using:
mediawiki version: 1.19.1
php: 5.3.6 (apache2handler)
mysql: 5.5.16

i don't think possible without modifying php code skin you're using (e.g. skins/vector.php vector skin). if want that, code render navigation tabs is, surprisingly enough, in rendernavigation() method. or modify key string (normally used inject title , accesskey attributes link) tab after has been set in execute().

if don't idea of hacking skin, easier solution might use javascript. following code (with name_of_tab replaced name of custom tab) in site javascript ought it:

jquery( function ( $ ) {     // run code after page has loaded:     $( '#ca-name_of_tab a' ).attr( 'target', '_blank' ); } ); 

of course, nothing users javascript disabled. there's tiny window might able click link after has loaded before javascript has had chance run.

it's possible, in principle, avoid last issue hiding tab css until js code runs. however, making sure tab always starts out hidden, only if js enabled, without hacking skin, regardless of whether mediawiki configured async script loading, gets... surprisingly tricky. in fact, gave on trying figure out. maybe writing custom resourceloader module might it, i've spent way time on already.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -