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

Route match for 'resources'

Valhalla

Well-known member
#1
Hello,

What is the best way to find the current route? I want something that will work with any Route Filters that may be in place.

I'm hoping to use something similar to the code below.

PHP:
public static function frontControllerPreView(XenForo_FrontController $fc, XenForo_ControllerResponse_Abstract &$controllerResponse, XenForo_ViewRenderer_Abstract &$viewRenderer, array &$containerParams)
{
     $route = $fc->route();
     if (!XenForo_Visitor::getUserId() && $route != 'resources')
     {
          $containerParams += array(
               'containerTemplate' => 'LOGIN_PAGE_CONTAINER',
               'contentTemplate' => 'error_with_login'
          );
     }
}
Thanks,
 
Last edited:

Valhalla

Well-known member
#3
Another thing, for anyone finding the above - I couldn't set the 'contentTemplate' using $containerParams.

Instead,

PHP:
$controllerResponse->templateName = 'error_with_login';