Am Mittwoch 27 Dezember 2006 15:21 schrieb Lane, Ryan:
I'm working on a new extension, and it adds quite
a bit of new CSS and
Javascript. Other than hacking MonoBook.php, is there an easy way for me
to add stuff into the headers? I can't seem to find any hooks that do
this...
This is what the SelectCategory extension does:
<code>
$wgHooks['OutputPageParserOutput'][] = 'fnSelectCategoryOutputHook';
## Entry point for the hook for printing the CSS:
function fnSelectCategoryOutputHook( &$m_pageObj, &$m_parserOutput ) {
global $wgScriptPath;
# Register CSS file for our select box:
$m_pageObj->addLink(
array(
'rel' => 'stylesheet',
'type' => 'text/css',
'href' =>
$wgScriptPath . '/extensions/SelectCategory/SelectCategory.css'
)
);
# Be nice:
return true;
}
</code>
Not sure if that's the best way, though, since that would cause another http
request per unique user.
-- Leon