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

How do I add my own navigation tab in the adminCP, with my own side column?

TheBigK

Well-known member
#1
My intention is to add a navigation tab in the adminCP menu, along with the existing ones :

Home | Applications | Users | Appearance | Tools | MY TAB | Development

So far -

1. I have been able to create "My TAB" using Admin Navigation menu.

Screen Shot 2015-11-06 at 11.51.57 AM.png

2. Have created a route prefix -

Screen Shot 2015-11-06 at 11.52.52 AM.png


3. Written some code -

PHP:
class AppsAdmin_Route_Admin_Index implements XenForo_Route_Interface
{
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
return $router->getRouteMatch('AppsAdmin_ControllerAdmin_Index', $routePath, 'appsadmin');
}
}
4. ControllerAdmin

PHP:
<?php
class AppsAdmin_ControllerAdmin_Index extends XenForo_ControllerAdmin_Abstract
{
public function actionIndex()
{
$viewParams = array();
return $this->responseView('AppsAdmin_ViewAdmin_Index', 'appsadmin', $viewParams);
}
}
5. Have created an admin template by the name "appsadmin", added a title to it.

So far so good.

Problems:

1. I am wondering why am I not seeing my "Blogger Performance Report" link in the sidebar?

What's missing?[/code]
 

Robust

Well-known member
#4
"Blogger performance report" is what you can't see? "Apps Admin" is visible. What's the navigation link info for blogger performance report? Did you tick the 'hide this navigation when there are no viewable children' on it?
 

TheBigK

Well-known member
#5
"Blogger performance report" is what you can't see? "Apps Admin" is visible. What's the navigation link info for blogger performance report? Did you tick the 'hide this navigation when there are no viewable children' on it?
Well, I do see 'Apps Admin' at proper location. However, when I click on it, I see the contents (sidebar and main panel) from the 'Home' tab. I'd like to see my own left sidebar that lists "Blogger Performance Report" and the main panel should load the contents from my template.
 

Robust

Well-known member
#6
Well, I do see 'Apps Admin' at proper location. However, when I click on it, I see the contents (sidebar and main panel) from the 'Home' tab. I'd like to see my own left sidebar that lists "Blogger Performance Report" and the main panel should load the contents from my template.
Oh, right, you're just not seeing the sidebar options. You use a template or something for that, never played around with it so I'm not sure where you set that. Take a look at XF code for the Applications tab or something.
 

Jake B.

Well-known member
#8
Oh, right, you're just not seeing the sidebar options. You use a template or something for that, never played around with it so I'm not sure where you set that. Take a look at XF code for the Applications tab or something.
You set it in your route as the third parameter in $router->getRouteMatch. Looks like his is already though. If you want to export the add-on and send me the files I can take a look for you @TheBigK
 

Chris D

XenForo developer
Staff member
#9
The third parameter of getRouteMatch ("appsadmin" in your case) should match the ID of the parent navigation entry that should be activated. Therefore, the navigation ID of your "Apps Admin" navigation should be "appsadmin" rather than "appsAdmin" (or the third paramter of getRouteMatch should be "appsAdmin" instead of "appsadmin".
 

Jake B.

Well-known member
#10
The third parameter of getRouteMatch ("appsadmin" in your case) should match the ID of the parent navigation entry that should be activated. Therefore, the navigation ID of your "Apps Admin" navigation should be "appsadmin" rather than "appsAdmin" (or the third paramter of getRouteMatch should be "appsAdmin" instead of "appsadmin".
Ooh, good catch. Didn't even notice that, was looking at the screenshot of his route prefix configuration and saw that they matched didn't notice he had one of his navigation configuration too
 

TheBigK

Well-known member
#11
The third parameter of getRouteMatch ("appsadmin" in your case) should match the ID of the parent navigation entry that should be activated. Therefore, the navigation ID of your "Apps Admin" navigation should be "appsadmin" rather than "appsAdmin" (or the third paramter of getRouteMatch should be "appsAdmin" instead of "appsadmin".
Wow! That got the job done!

Screen Shot 2015-11-07 at 8.40.10 AM.png