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

Route match for 'resources'

Discussion in 'XenForo Development Discussions' started by Valhalla, Jan 24, 2015.

  1. Valhalla

    Valhalla Well-Known Member

    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 $fcXenForo_ControllerResponse_Abstract &$controllerResponseXenForo_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: Jan 24, 2015
  2. Valhalla

    Valhalla Well-Known Member

    PHP:
    $route $fc->route();
    if (!
    XenForo_Visitor::getUserId() && $route->getMajorSection() != 'resources')
    {

    }
     
  3. Valhalla

    Valhalla Well-Known Member

    Another thing, for anyone finding the above - I couldn't set the 'contentTemplate' using $containerParams.

    Instead,

    PHP:
    $controllerResponse->templateName 'error_with_login';
     

Share This Page