Hi, you guess right, I try to make a small extension to add extra tabs right beside the page / talk / edit tabs of the used skin. The idea is to have a simple navigation to swap betweeen the three namespaces. The namespaces represent different views on the same topic, say customer service info, technical support info, product management info on a certain product.
I've found a code sample that will do so with a static url to stick with the new tab, now I'm searching an easy way to get it working dynamic. I've added the php code below, to make it possibly more clear. To get it work dynamically, I would need to compare if the actual display page is one of the 3 namespaces Tec / PM / CS and which is the title of the page ('Seite' in the code below). I Could parse the URL by myself of course, but hoped there is an easy way to access the values though wiki object attributes.
Next step will be to detect if the specific Namespace:title exists yet, so I can make the extension decide to display the action tab in red or blue and to skip making the extra tab buttons in case the actual displayed page is a specialpage.
My problem is, I am not too familiar with the wiki object modell, I read accross the manual for article and title classes, but didn't get the clue yet how access the values I needed. Just hoped to find someone here, who is so familiar with that so he/she can tell this out of sleep :) If this was to optimistic, I'll go on trying to understand from the manual :)
Regards,
Dennis
<?php
// ParserHook
$wgHooks['SkinTemplateContentActions'][] = 'ReplaceTabs';
// Function to add the tabs
function ReplaceTabs ($content_actions) {
$tectitle = Title::newFromText('Tec:Seite');
$pmtitle = Title::newFromText('PM:Seite');
$cstitle = Title::newFromText('CS:Seite');
$main_action['tec'] = array(
'class' => false, //if the tab should be highlighted
'text' => 'Tec', //what the tab says
'href' => $tectitle->getFullURL(), //where it links to
);
$main_action['pm'] = array(
'class' => false, //if the tab should be highlighted
'text' => 'PM', //what the tab says
'href' => $pmtitle->getFullURL(), //where it links to
);
$main_action['cs'] = array(
'class' => false, //if the tab should be highlighted
'text' => 'CS', //what the tab says
'href' => $cstitle->getFullURL(), //where it links to
);
$content_actions = array_merge( $main_action, $content_actions); //add tabs to the bar
return true;
}
?>