• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Add own Navigation Tabs

  • Thread starter Thread starter ragtek
  • Start date Start date
PHP:
<?php
class Navtabs
{
    public static function addNavbarTab(array &$extraTabs, $selectedTabId)
    {
        $extraTabs['aboutus'] = array(
            'title' => new XenForo_Phrase('about_us'),//phrase with the title for the link
            'href'  => XenForo_Link::buildPublicLink('pages/about_us'),
            'position'  =>  'middle'
      );
    }
}
 
And what's the content of Navtabs.php???
THe file needs to have already the necessary content...

PS: you shoudn't add anything into xenforo directory!
 
Gah got it now, it added itself now.

ragtek bud can you update the first post a bit now :p

Clicking it seems to make the "Forum" tab be highlighted not itself though?
 
The route is responsible for the highlited tab.

The problem is, that the pages have already there "fix route" with the fix highlighted forum tab!

PHP:
return $router->getRouteMatch('XenForo_ControllerPublic_Page', 'index', 'forums');

I've found a way to manipulate this, BUT this requres editing of the router class XenForo_Route_Prefix_Pages
 
AHH; wait, there's a event availabe for routes

HRHRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRr

addon will come in the next days:) just need to find a way to edit the admin page template
 
So it is possible then? :)

I take it for this addon it will be the usual release on your site for premium and then on here 5 days later?
 
AHH; wait, there's a event availabe for routes

HRHRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRr

addon will come in the next days:) just need to find a way to edit the admin page template
load_class_route_prefix - couldn't you use that listener to re-route the request if the page node = x
 
load_class_route_prefix - couldn't you use that listener to re-route the request if the page node = x
exactly;)^^

with an file edit it would be MAYBE something like (haven't tested it, but i think it should work^^

PHP:
    public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
    {
        $request->setParam('node_name', basename($routePath));
        switch ($request->getParam('node_name'))
        {
            case 'foo':
                return $router->getRouteMatch('XenForo_ControllerPublic_Page', 'index', 'mytab1');
            break;
            case 'foobar':
                return $router->getRouteMatch('XenForo_ControllerPublic_Page', 'index', 'mytab2');
            break;
            default :
               return $router->getRouteMatch('XenForo_ControllerPublic_Page', 'index', 'forums');
        }

    }
 
The "hard" part will be the userfriendly connection between pages & selectedtab id
 
Top Bottom