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

Pages vs navigation highlighting

Discussion in 'XenForo Development Discussions' started by TerminalAddict, Mar 6, 2011.

  1. TerminalAddict

    TerminalAddict Active Member

    I've got a couple of pages:
    and quite likely to build a couple more.

    What I would like to do is have links in my navigation bar (as I have) but change the selected tabs.
    It looks like I have to change the current to class "selected", and change the forums tabs a bunch of way.

    Can anyone give me some guidance please?
    How would I go about doing this?

  2. Arik

    Arik Well-Known Member

    The selected tab is assigned based on the major section parameter in the Route Prefix. In the Pages route, that's this line:

    return $router->getRouteMatch('XenForo_ControllerPublic_Page''index''forums');
    I released a hack a while back that lets you mangle the node name and get a custom tab selected. It can be extended to only account for certain tabs. However, if you know some PHP and how to write a XenForo addon, it might be a better idea (more fun?) to create your own route prefix. Only drawback I can see doing it that way (and I've only given it a cursory thought) is that it wouldn't link correctly when displayed in the node tree.

    Here's the mod I did, for reference.
  3. TerminalAddict

    TerminalAddict Active Member

    mmm I do know php (a bit :) )
    but clearly I need to read a bit more ;)

    I have used PageCallBacks for each of my pages (or at least most of them)
    and I'm returning $response .. can I also branch off and do something with $router->getRouteMatch ?
  4. Arik

    Arik Well-Known Member

    I haven't gone through the whole stack, but I don't think the router is in scope once you get into the Controller.

  5. Arik

    Arik Well-Known Member

Share This Page