Manual talk:$wgDefaultSkin

From mediawiki.org
Latest comment: 9 years ago by 88.130.85.211 in topic Moved from Manual:LocalSettings.php

What if no custom default is set?[edit]

So, if a default skin is NOT SPECIFIED in $wgDefaultSkin, what skin is used? In my version of MediaWiki, $wgDefaultSkin is commented so a default skin is not set. Which one is used by default?

The default value, shown in the infobox at the top of the page ('monobook' in this case) tells you what value will be used if you do not set a value in LocalSettings.php --HappyDog 14:01, 15 May 2006 (UTC)Reply
Also note that the installer already takes care to set the value in LocalSettings.php, so usually, a value will be set. Only if there is none (which should not happen as the installer does set it in LocalSettings.php), the default from DefaultSettings.php will kick in. --88.130.85.211 14:27, 11 May 2014 (UTC)Reply

Moved from Manual:LocalSettings.php[edit]

Aside from the standard Default Skin setting which is documented within the LocalSettings.php file: $wgDefaultSkin = 'monobook'; I've discovered this handy little hack for overriding the default skin based on the browser type. I found this trick to be especially handy after playing around with the new web browser on my Nintendo Wii. As font sizes for the default skin are fine for a computer screen, but much to small for a TV screen. Without a larger font you have to zoom and scroll far to much for a MediaWiki sites to be useful. I choose the "chick" skin, though the font size could still be a tad larger. You could also create a Wii (or whatever) skin to override with, I've done so by modifying the standard monobook skins main.css, scaling up the body from x-small to medium, and then scaling the personal and caction bars back down to fit the screen width.

Within LocalSettings.php add the following, including an optional note to modify the User.php file if you also wish to override a logged in users skin preferences, if not just skip that part.

# To Override skins based on browser type in includes/User.php change line 1042 or 1196
# from:                      $userSkin = $this->getOption( 'skin' );
# to:                        global $userSkin;
# to:   if ( ! $userSkin ) { $userSkin = $this->getOption( 'skin' ); }
if ( preg_match( "/Nintendo Wii/i", $_SERVER['HTTP_USER_AGENT'] )) { $wgDefaultSkin = 'wii'; $userSkin = 'wii'; }
# Uncomment the following line for testing with a common browser type, chick is a good standard skin to try.
#if ( preg_match( "/Mozilla/i", $_SERVER['HTTP_USER_AGENT'] ))    { $wgDefaultSkin = 'wii'; $userSkin = 'wii'; }
This code can most likely be optimized further and may be more appropriate for another page here at MediaWiki, feel free to modify or move it... --D0li0 08:49, 18 January 2007 (UTC)Reply
I'm curious is this talk page is searched by anonymouse visitors looking for "HTTP_USER_AGENT" tricks like I was? BTW: This seems to work with v1.6, but not quite with v1.5 yet. --D0li0 23:45, 20 January 2007 (UTC)Reply
I've fixed the above block of code, adding the global line and inverting the if condition, which did but shouldn't have been working. Now the same modification works for v1.5, v1.6, and probably others. --D0li0 10:09, 21 January 2007 (UTC)Reply
I'd like to move this section into the main Manual:$wgDefaultSkin article as a new section named HTTP_USER_AGENT based skin choice, as that's what I'd be searching for if I were looking for a solution like this... I'll move it there in a few days if there are no objections. --D0li0 10:14, 21 January 2007 (UTC)Reply
If I wanted to change the skin based on the visitor's system, I would definitely not do that by editing Core files, but I would add that in LocalSettings.php. However, note that this can basically be done with every configuration variable and in so far is not unique to $wgDefaultSkin. --88.130.85.211 14:30, 11 May 2014 (UTC)Reply