Global var in VIEW

I want set global var in VIEW for authorized users: ```php $di->set('session', function(){ $session = new Phalcon\Session\Adapter\Files(); $session->start(); return $session; });

$di->set('view', function() use ($config) {
    $view = new \Phalcon\Mvc\View();
    $view->setViewsDir( APP_PATH . $config->phalcon->viewsDir );
        ".phtml" => 'voltService'
    $session = new Phalcon\Session\Adapter\Files();
    $auth = $session->get('auth');
    if( $auth )
        $view->setVar("auth" , true);
    return $view;

``` this code not work, because in $di->set('view') section i can not get $session->auth, but if i use construction: ```php $di->set('view', function() use ($config, $di) { ... $session = $di->get('session'); $auth = $session->get('auth'); //vardump($auth); if( $auth ) $view->setVar("auth" , true); ... } ``` $di->set('session') call twice and i have notice "A session had already been started - ignoring sessionstart()" And i think what this not a right method. Thx for help.

-$session = $di->get('session');
+$session = $di->getShared('session');


Спасибо :)