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

Three Routes In One Selected NavTab

Marcus

Well-known member
#1
Example: My forum has a navtab "horror". There is a route horror and it works with that. But there are also other routes horrorbooks and horrormovies.
Home Forums Horror Members Help
Horror-General Horror-Books Horror-Movies
How could I combine all three routes in 'selected' => ($selectedTabId == 'horror')?
PHP:
<?php 
class MyProduct_Listener
{
	public static function navTabs(array &$extraTabs, $selectedTabId)
	{	
		$extraTabs['product'] = array(
				'title' => 'horror',
				'href' => XenForo_Link::buildPublicLink('full:horror'),
				'selected' =>  ($selectedTabId == 'horror'),
				'position' => 'middle',
				'linksTemplate' => 'horror_navtab',
		);
	}
 

Chris D

XenForo developer
Staff member
#2
When you're creating your templates, you will use something like this for your Horror Books page, for example:

Code:
<xen:navigation>
<xen:breadcrumb href="{xen:link full:horror}">Horror</xen:breadcrumb>
<xen:breadcrumb href="{xen:link full:horrorbooks}">Horror Books</xen:breadcrumb>
</xen:navigation>
With that code, the template will know to ensure the selected tab is horror.
 

Marcus

Well-known member
#4
Ok it's easy. Just have "horror" as a parameter at the end of the getRouteMatch function for each match.

public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
$action = $router->resolveActionWithIntegerParam($routePath, $request, 'invoice_id');

return $router->getRouteMatch('Horror_ControllerPublic_HorrorBooks', $action, horror);
}

public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
$action = $router->resolveActionWithIntegerParam($routePath, $request, 'invoice_id');

return $router->getRouteMatch('Horror_ControllerPublic_HorrorMovies', $action, horror);
}