Controller for route could not be found

Gossamer

Active member
I'm trying to setup an admin route, but I keep getting an error that it can't find the controller for my route. Here is what I have so far:

I've created the route prefix.
e714d4a918a32e80c2f4d7afa7361d56.png


Created code for the route prefix:
PHP:
 class Goss_RPGSkillSystem_Route_PrefixAdmin_SkillCategory implements XenForo_Route_Interface
{
    /**
    * Match a specific route for an already matched prefix.
    *
    * @see XenForo_Route_Interface::match()
    */
    public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
    {

        return $router->getRouteMatch('Goss_RPGSkillSystem_ControllerAdmin_Category', $routePath, 'skill-categories');
    }
    /**
    * Method to build a link to the specified page/action with the provided
    * data and params.
    *
    * @see XenForo_Route_BuilderInterface
    */
    public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
    {
        return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data);
    }
}

Created a ControllerAdmin file:
PHP:
class Goss_RPGSkillSystem_ControllerAdmin_Category extends XenForo_ControllerAdmin_Abstract
{
    public function actionIndex()
    {
        $viewParmas = array();

        return $this->responseView('Goss_RPGSkillSystem_ViewAdmin_Index', 'goss_skillsystem_category_list', $viewParams);
    }
   
}

And lastly I created a template titled goss_skillsystem_category_list with some placeholder text in it.

However, when I try to go to admin.php?skill-categories, I get this error:
e1b8a220999c81b3df3318dbb8333dcd.png


Any ideas what I'm doing wrong?
 
What is the exact location of the controller file?

It should be library/Goss/RPGSkillSystem/ControllerAdmin/Category.php, case sensitive.

Liam
 
Thanks! Turned out I was missing the <?php. Or rather, I had <? php and that space broke it.

My link is loading now. However, the template isn't rendering on that page. Here is the code for my controller:

PHP:
<?php
class Goss_RPGSkillSystem_ControllerAdmin_Category extends XenForo_ControllerAdmin_Abstract
{
    public function actionIndex()
    {
        $viewParams = array();

        return $this->responseView('XenForo_ViewAdmin_Base', 'goss_skillsystem_category_list', $viewParams);
    }
   
    /** 
    * Get the category model.
    *
    * @return Goss_RPGSkillSystem_Model_Category
    */
    protected function _getCategoryModel()
    {
        return $this->getModelFromCache ( 'Goss_RPGSkillSystem_Model_Category' );
    }
   
}
?>

I double checked that the template title matched too. goss_skillsystem_category_list
 
Nevermind! Realized I had created my template in the regular section instead of with the admin templates.
 
Back
Top Bottom