selectedTab question

Cupara

Well-known member
I am creating an addon that creates an additional page that is viewed from the forum perspective, how would I tell this page to select the Forums tab when viewing the page?

I have tried many ways but I am not sure how to do this specifically. This would also help with another addon I'm building.
 
In your route prefix class, the 3rd parameter (majorSection) for the getRouteMatch() method should be 'forums'.
That should work. :)

PHP:
	/**
	 * Gets a route match object.
	 *
	 * @param string $controllerName
	 * @param string|false $action
	 * @param string $majorSection
	 * @param string $minorSection
	 *
	 * @return XenForo_RouteMatch
	 */
 
'forums', 'members' and 'help' selects the corresponding tab.
But strangely, passing 'home' as the parameter doesn't select the Home tab. :confused:

*Diving into the source to see what's happening...

EDIT:
Looks like it's the only tab that can't be selected.
 
Hehe, I've been swimming around the source for the last 24 hours and cannot find why the home tab can't be selected. I created this thread just in case I was missing something.
 
In template called navigation you can see that Home tab doesn't have conditions that may make it selected unlike other tabs.
 
In template called navigation you can see that Home tab doesn't have conditions that may make it selected unlike other tabs.
Yeah. The home tab isn't a tab per-se.

Would've been great if the XenForo_Dependencies_Public::_getNavigationContainerParams() method & navigation template contained proper logic for selecting the home tab, even though it won't be used by the any XF core feature anytime soon.

Now who's posting the bug/enhancement report? :p
 
I havent looked at the code yet..(starting next week) but, just a thought, i suppose that home is the default tab?
i.e. if no tab is selected, the home tab is selected by default..
 
Ok I found a work around, I'll comment out the tab in the template and just add an extra tab via the event listener.
 
I ran into another problem. I managed to get my own Home tab in there but when you view a page it says: Home > Home > Page

So I am trying to figure out a work around for that but coming up empty handed. Any ideas?
 
Well when I want my own home tab i just define in options (where you input forum url and homepage url) the link to that page, and when i click the hometab it goes to my page.
But maybe we are talking about different things.
 
Well I had a look, and figured that the home tab is nothing else than a html element in a template and not generated..
I read in another thread, that Kier was going to find a way to make home tab a "real" tab

For the moment, I can just remember the way we did changes like that in vbulletin when there was no template_hook around. (it was not very elegant)

We simply replaced the bit of code or the phrase in the template cache with str_replace or str_replace_callback. (I do not know if there is something similar to template_cache in xf. But if yes, you could just replace whats between <!-- home --> and <!-- forums --> in template navigation with the code of a new tab.

(I''m just writing what goes through my head as you said you were looking for "Ideas")
 
Yeah tried that but I will probably just have to keep it the way I have it for now until Kier releases a new version that has Home tab as its own tab. So php file altering will be required for my portal system.
 
Top Bottom