Extension talk:CSS/Archive

Parser-caching problem
There's a bug which is causing the CSS to intermitently not get included in the page and I haven't been able to figure out how to fix it yet. This is why the status of the extension has been returned to "beta". There's an example of this extension in use at CSS example, if the page has big coloured spots in the background, the the css has been included properly.
 * The bug is probably related to parser caching as I didn't see any provision in your code to account for this functionality. Jean-Lou Dupont 23:50, 24 August 2007 (UTC)
 * Thanks a lot! that was the problem :-) --Nad 23:58, 24 August 2007 (UTC)

The code in the svn still breaks caching! Comment the following line in the function "magicCss" if you want to use caching!!: $parser->mOutput->mCacheTime = -1; Dmh 19:39, 18 September 2009 (UTC)

Produces Invalid HTML
The URLs generated contain ampersands which are not properly escaped, so wiki pages which use this extension are no longer valid XHTML. See the output from the W3C HTML validator on the Spots page On that page there are some other markup errors, but on some sites the only markup errors are due to this extension. This makes CSS.php unusable on sites which care about HTML validity.

Simple to fix. Add this line in magicCss: $url = str_replace("&", "&amp;amp;", $url);

At least, that does it for me. (Note that I had to double the escaping to get this patch to appear on this wiki page.) -- sandro@w3.org 13:53, 29 December 2007
 * Ok thanks, I've added that in --Nad 21:26, 30 December 2007 (UTC)


 * Fix does solve the problem, but not in the current code base Mediawiki 1.17.0. See section below for code to change.  Zzmonty 13:10, 25 August 2011 (UTC)

Doesn't work with Cite extension
There seems to be a bug with this extension when cite.php is also used. The style sheet referenced appears to be ignored. Could anyone point towards how this might be corrected? --Philipjoslin 10:01, 6 December 2007 (UTC)
 * Is the site you have it on public so I can have a look at what's happening? is there errors or anything? --Nad 21:34, 8 December 2007 (UTC)
 * I have Cite and CSS installed and CSS does not work. The Wiki I am using is not public, sorry. --EToreo 20:53, 19 December 2007 (UTC)

conflicts with Special:Specialpages
Prevents acess to Special:Speacialpages (as well as the CategoryLink extension) Can I just point out to this? Can it be fixed, please. Thanks.
 * I don't have any such conflicts - what is the MediaWiki version this is happening on? the error indicates that you're including the extension twice - in the mean time try using include_once statements to install so that the second include doesn't happen. --Nad 06:19, 11 September 2008 (UTC)

I did require_once and now that;s OK. Why not change the installation instructions? To answer your question: My Installed software Product 	Version MediaWiki 	1.12.0 PHP 	5.2.5 (cgi) MySQL 	5.0.51a-community-log

Will this work for longer CSS coding?
I have a page that requires CSS in it. The CSS coding is much longer than that shown on the example page. When I created a page called Syn'sTemplateDesignPageCSS.css and inserted the CSS coding, then added the tag to the page to call the CSS, it didn't work. 75.167.200.148 01:02, 5 March 2008 (UTC)

1.12
This doesn't seem to be working in 1.12. --Sasoriza 13:15, 27 March 2008 (UTC)

Has anyone made progress with getting this to work in 1.12? While there are alternatives (like Extension:PageCSS), many pages are already using this extension, which would be time-consuming to change individually (and don't say, use a bot). This extension should be upgraded to work in newer versions if possible. –Sasoriza 13:30, 23 May 2008 (UTC)
 * Try installing the new version on SVN --Zven 23:38, 31 May 2008 (UTC)
 * I have it running on 1.12 with no problems. The extension does not prevent other CSS's such as Common.css or Monobook.css from loading, it simply adds another CSS which is loaded before the main ones which means you will have to ensure that your CSS rules are more specific than the existing ones to prevent them being overridden (this is what I mean by "specific"). Also I've made a few changes to the code to allow files or in-line rules to be included. --Nad 01:40, 1 June 2008 (UTC)
 * Works for me on 1.12, too. I installed trunk (r59210). --Arthaey 00:16, 18 December 2009 (UTC)

Inline CSS
I've noticed that inline css gets escaped with htmlspecialchars (line 44 current SVN revision). This conflicts with some chars used in CSS like quotes. becomes I don't think this is the desired result ;-) Imo htmlspecialchars should simply be removed. Thanks. Der Papst 20:35, 30 July 2008 (UTC)
 * I can't remember why it had htmlspecialchars there, I've removed it now. --Nad 21:40, 30 July 2008 (UTC)


 * Not fixed in the current code base Mediawiki 1.17.0 Zzmonty 13:15, 25 August 2011 (UTC)

Order of inclusion
When inline CSS is used this gets included before MediaWiki:Common.css. This can be a problem as it's not possible to override when other CSS is processed after yours. --Rob 02:44, 22 October 2008 (UTC)

This whould be interesting for many, and me as well. How can we - or could you - add an option to change the order, so that the Extensions SCC is included last and overrides all other style sheets on the same level of definition. Thanks fot this great plugin, which we are going to use on two pages with about 2000 documents. Sincerely yours --Burgy Zapp 17:06, 28 February 2009 (UTC)

Problem installing?
I've installed the CSS extension as per the instructions on the website, but it doesn't appear to be running. All I get for my sheet is a massive mess. Can someone please help me out? My contact e-mail is z@demon-sushi.com. --Cinnemalt 12:50, 27 March 2009 (EST)

Hello, i got one error "ereg is deprecated" line 46 in CSS.php. I followed this link and fix :

it work now but i dont know if it really good because i am not php coder. Oeil 13:33, 19 December 2009 (UTC)

The bug fix shown above works for me too.
This fix works with MediaWiki 1.16.5 (at least for me, so far...).
 * Replace
 * With
 * -- Davydog 00:54, 17 September 2011 (UTC)

Hi, I have got a problem whereas the extension does not appear to work. I have followed the instructions (i.e. placed the files in the extensions/ dir and added the include command in the LocalSettins.php file) but all I have when I try inline CSS definition is the actual definition appearing as text within my wiki page. Any idea what is going on? Thanks. diferdin 10:20, 26 March 2010 (GMT)

Current Version Compatability?
I'm trying to use the CSS extension with Apache 2.2, PHP 5.3.2RC2 and MediaWiki 1.15.1. Whenever I enable the CSS extension, I receive an error message of Warning: Parameter 1 to Language::getMagic expected to be a reference, value given in C:\Web\Docs\wiki\includes\StubObject.php on line 58

Is this just because the CSS extension is not compatible with PHP 5.3.2RC2?

I have the same issue. Any advice?


 * My development machine is: MySQL 5.1.39, PHP 5.3.2, and am using MWiki 1.14 and 1.15, and the extension does not work on this setup (single AMD 64 bit). My production machine is MySQL 5.0.77, PHP 5.1.6, and MWiki 1.14 (dual xeon 32 bit). The extension does work on this setup. On the devel machine I can see the hook being set, but it looks like it is never called. Maybe some kind of incompatibility with Parser.php?? Anyone else have this situation?? Thanks Tsx11 14:06, 24 July 2010 (UTC)


 * Same issue after upgrading Debian lenny (oldstable) to Debian squezze (stable):

Mediawiki-Debian-Version: 1:1.15.5-2 PHP5-Debian-Version: 5.3.3-7

Can not upgrade mediawiki to a version > 1.5 within Debian, because unstable (sid) is version 1:1.15.5-3 at the moment

Any advice to fix / work around this? --> The snapshot of version r60464 of the CSS extension for MediaWiki 1.16.x is working fine on Debian for me.

Same problem: version 1.15, server changed from PHP5.2 to PHP5.3, #css no longer worked. What shall I do? Look for another extension? --Bescheid 17:10, 24 March 2011 (UTC)


 * This doesn't look like a problem in Extension:CSS itself, but is rather due to changes in PHP from 5.2 to 5.3 affecting how some parts of MediaWiki work. Internals changes in PHP's handling of reference variables cause some old code patterns (which were often STRICTLY NECESSARY in the PHP 4.x days) to move from being harmless but unnecessary to either not working, or working but throwing an error message which itself causes problems.


 * The correct fix is to either:
 * Upgrade MediaWiki to a version that works with PHP 5.3 (try 1.16 or 1.17 release candidate?)
 * Downgrade PHP to a version that works with MediaWiki 1.15


 * If you can't do either of those, then you can attempt to copy over all the various PHP 5.3 compatibility fixes into your old version, starting with removing the '&' reference marker on the parameter on Language::getMagic (in languages/Language.php). However you will likely encounter other similar problems. --brion 17:35, 24 March 2011 (UTC)

ereg is deprecated
I got the ereg is deprecated error Oeil had above. Why is the fix that (s)he mentioned not yet part of the code? --Robinson Weijman 11:05, 26 July 2010 (UTC)

Bug fixes with content :before .first, etc.
As of 13:06, 25 August 2011 (UTC), Tested with Mediawiki 1.17.0
 * Remove the line containing htmlspecialchars (around line 48)
 * Around line 50 change the to be the following. (two lines will deleted)

Zzmonty 13:06, 25 August 2011 (UTC)