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
Hey, looks like that works. Thanks for the tip. Unfortunately
the hook is only available in mediawiki 1.8+, but I'll take
what I can get ;).
V/r.
Ryan Lane
Argh, I spoke too soon. This only seems to work when the parser cache is
purged. The "OutputPageBeforeHTML" does work though. Unfortunately, this
hook looks like it is broken in a number of ways.
Is there a good place to add a hook for this specific type of
functionality? I've put one in OutputPage.php in the output() function
above the section where the ajax javascript is added to the headers, and
it seems to work for regular page views, and during previews.
Unfortunately, I'm not sure exactly how this could affect other things.
Any ideas?
V/r,
Ryan Lane