Topic on Project:Support desk

Hook to position template above Category links

3
Spiros71 (talkcontribs)

Following this Topic:Rmxayk3g7uxk0t1h I have used the snippet indicated below to display a template on every article page. I tried to wrap the template into a div, but there seemed no way to position it above the Category links (or end of page content). Is there a hook that would allow that? I could not find one in Manual:Hooks. Also, how can I make it not display on Home page?

$wgHooks['ArticleViewHeader'][] = 'addHeaderToPages';

function addHeaderToPages( &$article, &$outputDone, &$pcache ) {
  global $wgOut;
  $wgOut->addWikiText('Template:AdditionalHeader');
  return true;
}


MarkAHershberger (talkcontribs)

Which skin are you using?

In any case, it looks like you can use the SkinTemplateOutputPageBeforeExec to modify $template's catlinks data like (I'm guessing) this:

$template->set( 'catlinks', 'YOUR-STUFF' . $template->get( 'catlinks' ) );

If you don't mind it being after the categorylinks, then you can use the SkinAfterContent hook.

Spiros71 (talkcontribs)
Reply to "Hook to position template above Category links"