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

XF 1.1 controllerName in css templates

Discussion in 'XenForo Questions and Support' started by ragtek, May 14, 2012.

  1. ragtek

    ragtek Guest

    Isn't it possible to use the xen syntax and global variables from

    PHP:
    public function preRenderView(XenForo_ControllerResponse_Abstract $controllerResponse null)
    {
    if (
    XenForo_Application::isRegistered('session'))
    {
    /* @var $session XenForo_Session */
    $session XenForo_Application::get('session');
    $this->_defaultTemplateParams['session'] = $session->getAll();
    $this->_defaultTemplateParams['sessionId'] = $session->getSessionId();
    }
    $this->_defaultTemplateParams['requestPaths'] = XenForo_Application::get('requestPaths');
     
    $options XenForo_Application::get('options')->getOptions();
    $options['cookieConfig'] = XenForo_Application::get('config')->cookie->toArray();
    $options['currentVersion'] = XenForo_Application::$version;
    $options['jsVersion'] = XenForo_Application::$jsVersion;
     
    $visitor XenForo_Visitor::getInstance();
    $this->_defaultTemplateParams['visitor'] = $visitor->toArray();
    $this->_defaultTemplateParams['visitorLanguage'] = $visitor->getLanguage();
    $this->_defaultTemplateParams['pageIsRtl'] = (isset($this->_defaultTemplateParams['visitorLanguage']['text_direction']) && $this->_defaultTemplateParams['visitorLanguage']['text_direction'] == 'RTL');
    $this->_defaultTemplateParams['xenOptions'] = $options;
    $this->_defaultTemplateParams['xenCache'] = XenForo_Application::get('simpleCache');
    $this->_defaultTemplateParams['serverTime'] = XenForo_Application::$time;
    $this->_defaultTemplateParams['debugMode'] = XenForo_Application::debugMode();
    $this->_defaultTemplateParams['javaScriptSource'] = XenForo_Application::$javaScriptUrl;
     
    if (
    $controllerResponse)
    {
    $this->_defaultTemplateParams['controllerName']   = $controllerResponse->controllerName;
    $this->_defaultTemplateParams['controllerAction'] = $controllerResponse->controllerAction;
    $this->_defaultTemplateParams['viewName']         = $controllerResponse->viewName;
    }
    }
    in the css templates?

    I've added this:
    Code:
    / extra controllername: {$controllerName} - view: {$viewName}
    <xen:if is="{$controllerName} == 'Ragtek_Debug_ControllerPublic'"}>....
    But non of the variables is shown:(
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Yorick likes this.

Share This Page