Manual talk:$wgStylePath

From mediawiki.org
Latest comment: 14 years ago by MaxSem in topic wrong name

No Default Value?[edit]

When I set $wgLogo = "$wgStylePath/common/images/logo.png"; in LocalSettings.php, nothing shows up. If I set it to $wgLogo = "$wgScriptPath/skins/common/images/logo.png";, however, it works just fine.
So I conclude that $wgStylePath is not set to $wgScriptPath/skins by default!?

  • Well , when I grep DefaultSettings.php, (> cat includes/DefaultSettings.php | grep 'wgScriptPath') I find
$wgStylePath   = false; /// defaults to "{$wgScriptPath}/skins"

So it seems like it does... blind leading the blind here, I'm having similar problems... I've started a topic, possibly related to this here: Project:Support desk#.24wgLogo Missing is from my LocalSettings.php.3F

-Tzf 00:25, 24 October 2007 (UTC)Reply

Yeah, I get the same thing. this is in mw 1.15.0.

It's almost like LocalSettings.php expects DefaultSettings.php to set it, and DS expects LS to set it.  ??!?!?! Everybody sets it to false, saying well, the default value is wgScriptPath/skins. but nobody sets it that way. Or else it gets set right downstream somewhere. I finally used

$wgLogo = "$wgScriptPath/skins/common/images/CrossWiseLogo.png";

like that, seems to work ok. OsamaBinLogin 20:55, 13 July 2009 (UTC)Reply

This is problematic[edit]

I agree that this is broken somehow, and as a consequence all documentation that refers to this variable is broken, too - namely $wgLogo.

I'm using MediaWiki 1.15.1 and it was no fun at all to find out how to point to a different image for the logo. I ended up explicitly redefining this variable in LocalSettings.php right after the line

require_once( "$IP/includes/DefaultSettings.php" );

to what this article documents as the default value

# I should not be doing this
$wgStylePath   = "{$wgScriptPath}/skins";

Then I could happily define

$wgLogo = "{$wgStylePath}/common/images/mylogo.png";

Please fix as a matter of urgency. Thanks. 122.26.138.182 03:06, 17 October 2009 (UTC)Reply

You shouldn't need to use stylepath for the logo, just use scriptpath directly; you don't have to put the logo image in the skins directory. Mr.Z-man 05:37, 18 October 2009 (UTC)Reply
If you don't need $wgStylePath for the logo, how do you explain that $wgLogo allegedly defaults to "{$wgStylePath}/common/images/wiki.png"? The first thing I did (and according to all these reports in this page and in the $wgLogo talk page) I'm in very good company) was to upload a file in wiki/skins/common/images/mylogo.png and explicitly set $wgLogo to "{$wgStylePath}/common/images/mylogo.png". This simply doesn't work, and in my analysis the reason it doesn't work is that it's not true that $wgStylePath defaults to "{$wgScriptPath}/skins", at least not in 1.15.1. This has wasted me quite some time and I don't want other people to suffer the same. I'm restoring the warning in the FAQ until this is clarified/fixed. Thanks. Hopefully acceptable username 13:47, 19 October 2009 (UTC)Reply
Besides, the FAQ clearly state "It is generally a good idea to place this at the end of LocalSettings.php, especially if you are using a variable such as $wgStylePath or $wgUploadPath." I think it is especially important to clarify this because the logo is likely to be the first thing that one changes, and these problems are not welcoming at all. Thanks. Hopefully acceptable username 13:51, 19 October 2009 (UTC)Reply
The documentation is a bit misleading, but just because something is the default doesn't mean that you need to be as close as possible to it. Really it shouldn't be in the skins directory because you might overwrite it when you upgrade. I've updated the documentation to make it more clear. Mr.Z-man 02:15, 24 October 2009 (UTC)Reply
Thank you. I still think that this ($wgStylePath) article needs clarifying, because it's simply not true that it defaults to "{$wgScriptPath}/skins". Also, I don't understand what you mean in $wgLogo when you say that it defaults "dynamically" via Setup.php, not in DefaultSettings.php, which is probably the issue here as well. Keep in mind that most users (especially novices, like me) will only fiddle with LocalSettings.php, and when someone (especially the official documentation) says that a variable defaults to a value, one would expect that variable to already have that default value in LocalSettings.php. Any other behaviour is just plain confusing. Thanks again. Hopefully acceptable username 12:02, 24 October 2009 (UTC)Reply
Thanks for bringing this up (and not letting it drop :)). I went ahead and posted on the mailing list. Things should behave less confusingly in 1.16. —Emufarmers(T|C) 04:33, 27 October 2009 (UTC)Reply

I continued the conversation, and it looks like we need to fix both the documentation here and the comments in DefaultSettings.php, which I am lazily doing. Thanks Hopefully acceptable username 06:46, 16 November 2009 (UTC)Reply

wrong name[edit]

The variable is called "stylepath" not "wgStylePath". Check this talk page's generated html right now. It will say: stylepath="/skins-1.5" 71.155.236.105 08:51, 3 December 2009 (UTC)Reply

This page discusses the PHP variable, not JS one. Max Semenik 09:03, 3 December 2009 (UTC)Reply

Use this setting for CDN?[edit]

Hi,

I'd like to load all the static resources from a Content Delivery Network (CDN) to take some load off Apache and my little web server. (using MW 1.17.0) I think I need to set $wgStylePath=http://cdn.something.com/ Then put everything currently in my /skins/ directory into http://cdn.something.com/ My only concern is the .php files that are currently in the /skins/ directory... My only thought is that I need to put all the sub-directories from /skins/ into the CDN, but not the .php files that are directly in /skins/ Is there a better way to achieve what I'm trying to do? Thanks, -Dan