[Mediawiki-l] additional CSS
Jim Wilson
wilson.jim.r at gmail.com
Wed Feb 7 20:34:58 UTC 2007
You can inject css files into any Skin by creating an extension like this
(modified to meet your needs of course):
------------------------- SNIP ----------------------------------
<?php
# My CSS Injection Extension
$wgHooks['OutputPageBeforeHTML'][] = 'wfAddCommonCSS';
function wfAddCommonCSS($out, $text) {
global $wgStyleDirectory;
$cssPath = $wgStyleDirectory.'/path/to/your/custom.css';
$out->addLink(
array(
'rel' => 'stylesheet',
'type' => 'text/css',
'media' => 'screen,projection',
'href' => $cssPath
)
);
# True to indicate that other handlers may continue to process this page
return true;
}
?>
------------------------- SNIP ----------------------------------
This will add a link to your common css file, which I assume will be
somewhere inside your skins directory (but you can put it where ever you
want as long as you set the value of $cssPath appropriately in the above
example.
Please note that this will add the css as the LAST ONE in the <head> section
of the rendered page. This means that your CSS styles will overwrite any
which were defined anywhere else (for example by a user's own personal css).
Hope this helps.
-- Jim R. Wilson
On 2/7/07, Fernando Correia <fernandoacorreia at gmail.com> wrote:
>
> How can I define a CSS file in addition to those on the skin?
>
> I'd like to make all pages include an additional CSS file, without
> having to modify the CSS files on the skins.
>
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l at lists.wikimedia.org
> http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>
More information about the MediaWiki-l
mailing list