MediaWiki talk:Common.css/Archives/2005

From Meta, a Wikimedia project coordination wiki

Help me pls

Hello, i want a common.css file on my mediawiki too, like on wikipedia, but it's not on my page headers and MediaWiki:Common.css is empty aswell, how can i do this?--QuestionUser 15:20, 31 December 2005 (UTC)

I answered this on your talk page, but I wanted to leave my answer here as well in case anyone else stumbled across this. —Locke Coletc 02:40, 4 January 2006 (UTC)

MediaWiki:Common.css

You need to modify includes\SkinTemplate.php to get MediaWiki to use MediaWiki:Common.css. You can see the necessary changes in the CVS at SourceForge, but here's what you should look for–

		# If we use the site's dynamic CSS, throw that in, too
		if ( $wgUseSiteCss ) {
			$sitecss .= '@import "' . $this->makeNSUrl(ucfirst($this->skinname) . '.css', 'action=raw&ctype=text/css&smaxage=' . $wgSquidMaxage, NS_MEDIAWIKI) . '";' . "\n";
			$sitecss .= '@import "' . $this->makeUrl('-','action=raw&gen=css' . $siteargs) . '";' . "\n";
		}

and change that to–

		# If we use the site's dynamic CSS, throw that in, too
		if ( $wgUseSiteCss ) {
			$query = "action=raw&ctype=text/css&smaxage=$wgSquidMaxage";		
			$sitecss .= '@import "' . $this->makeNSUrl('Common.css', $query, NS_MEDIAWIKI) . '";' . "\n";
			$sitecss .= '@import "' . $this->makeNSUrl(ucfirst($this->skinname) . '.css', $query, NS_MEDIAWIKI) . '";' . "\n";			
			$sitecss .= '@import "' . $this->makeUrl('-','action=raw&gen=css' . $siteargs) . '";' . "\n";
		}

Hope that helps. —Locke Coletc 02:40, 4 January 2006 (UTC)

I couldn't get this to work in v1.6.3 until I'd added

$wgUseSiteCss = true;

to LocalSettings.php, edited my MediaWiki:Common.css and then cleared my browser cache - the stylesheet was cached for a while really threw me... --86.17.247.172 21:55, 19 April 2006 (UTC)