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

Build a simple route like addon/get-pure-string-param

A

account8226

Guest
#1
Hello,

I have always build complex URLs in my addons, like addon-name/action/name.id.

But I never tried to do something simple.
I would like, to have an addon with the following routes :
Code:
board-url/addon/string-param
Actually, I was using the following code, but it's resolving the second param as an action, and not a simple get input.

PHP:
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
    {
        $action = $router->resolveActionWithStringParam($routePath, $request, 'name');
        return $router->getRouteMatch('A_ControllerPublic_Index', $action);
    }
Any ideas ?

Best regards.
 

Nobita.Kun

Well-known member
#3
PHP:
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
    {
        return $router->getRouteMatch('Addon_ControllerPublic_Addon', $routePath);
    }
Example in Addon_ControllerPublic_Addon you call actionAwesome so in URL should be {boardUrl}/{AddonPrefix}/Awesome
You can view: XenForo_ControllerPublic_Misc for more information ;)