Jaxel
Well-known member
I can easily make a route to "/xenforo/media/" with:
But what if I wanted to make a nested/sub route to "/xenforo/media/category/"? How would I do this? The problem is that every time you go to such an url, it would hit the original "media" router and ignore the "media/category" router. Because of this, I've been forcing my router to "index" instead of "$action" and simply doing the routing manually in my mods... this is the wrong way.
Code:
<?php
class EWRmedio_Route_Media implements XenForo_Route_Interface
{
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
$action = $router->resolveActionWithIntegerParam($routePath, $request, 'media_id');
$action = $router->resolveActionAsPageNumber($action, $request);
return $router->getRouteMatch('EWRmedio_ControllerPublic_Media', $action, 'media');
}
public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
{
$action = XenForo_Link::getPageNumberAsAction($action, $extraParams);
return XenForo_Link::buildBasicLinkWithIntegerParam($outputPrefix, $action, $extension, $data, 'media_id', 'media_title');
}
}
But what if I wanted to make a nested/sub route to "/xenforo/media/category/"? How would I do this? The problem is that every time you go to such an url, it would hit the original "media" router and ignore the "media/category" router. Because of this, I've been forcing my router to "index" instead of "$action" and simply doing the routing manually in my mods... this is the wrong way.