1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Overriding the active navigation tab

Adding more navigational context

  1. Chris D

    Chris D XenForo Developer Staff Member

    Chris Deeming submitted a new resource:

    Overriding the active navigation tab - Adding more navigational context

    Read more about this resource...
     
  2. LandNetwork

    LandNetwork Member

    $this->_routeMatch->setSections('players'); in a custom Kotomi page is producing a white page...?
     
  3. Chris D

    Chris D XenForo Developer Staff Member

    The exact code will vary depending on the objects and properties available to the class you're working with. I'm not totally familiar with the Kotomi page, but if it doesn't somehow have access to a controller object or RouteMatch object then setting the sections won't be possible.

    If you can share the current code you have, I might be able to make suggestions, but it might just not be possible.
     
  4. LandNetwork

    LandNetwork Member

    I have library/LandNetwork/Tabs/Tabs.php:
    PHP:
    <?php
    class LandNetwork_Tabs_Tabs
    {
        public static function 
    addNavbarTab(array &$extraTabs$selectedTabId)
        {
            
    $extraTabs['gametypes'] = array(
                
    'title' => 'Gametypes',
                
    'href'  => 'gametypes',
                
    'position'  =>  'middle',
            );
            
    $extraTabs['players'] = array(
                
    'title' => 'Players',
                
    'href'  => 'players',
                
    'position'  =>  'middle',
            );
            
    $extraTabs['shop'] = array(
                
    'title' => 'Shop',
                
    'href'  => 'shop',
                
    'position'  =>  'middle',
            );
            
    $extraTabs['radio'] = array(
                
    'title' => 'Radio',
                
    'href'  => 'radio',
                
    'position'  =>  'middle',
            );

    }
    which is hooked into an addon titled "LandNetwork", which has a code event listener and runs the above function (addNavbarTab).

    This creates the tabs fine, but do you know how I'd make the tabs selected?

    The pages it links to are Kotomi Bridge pages, each coded like this:
    PHP:
    <?php
    $startTime 
    microtime(true);
    $kotomi_indexFile "";
    $kotomi_container true;
    $fileDir dirname(__FILE__)."{$kotomi_indexFile}";
    require 
    "{$fileDir}/library/Dark/Kotomi/KotomiHeader.php";
    require_once(
    "library/LandNetwork/Framework/database.php");
    ?>

    // Any HTML code, and page content.

    <?php
    require "{$fileDir}/library/Dark/Kotomi/KotomiFooter.php";
    ?>
    Any help appreciated... :(
     
  5. Chris D

    Chris D XenForo Developer Staff Member

    I'm not entirely convinced it's possible, to be honest.

    I had a quick look, but it seems as though the initialisation of the XF framework is done inside the KotomiHeader and a custom front controller object.

    You may want to look at using the Page Node system with callbacks or creating these as proper XF add-ons which would include a few extra steps.
     

Share This Page