classes/ViewFactory.php
public static function create(ContainerInterface $container, Request $request = null)
    {
        if (!isset($request)) {
            $request = $container['request'];
        }

        $view = new Smarty(__DIR__.'/../templates/');
        if (in_array('https', $request->getHeader('X-Forwarded-Proto'))) {
            $request = $request->withUri($request->getUri()->withScheme('https')->withPort(443));
        }

        $smartyPlugins = new SmartyPlugins($container['router'], $request->getUri()->withUserInfo(null));
        $view->registerPlugin('function', 'path_for', [$smartyPlugins, 'pathFor']);
        $view->registerPlugin('function', 'base_url', [$smartyPlugins, 'baseUrl']);

        return $view;
    }
public static function create(ContainerInterface $container, Request $request = null)
    {
        if (!isset($request)) {
            $request = $container['request'];
        }

        $view = new Smarty(__DIR__.'/../templates/');
        if (in_array('https', $request->getHeader('X-Forwarded-Proto'))) {
            $request = $request->withUri($request->getUri()->withScheme('https')->withPort(443));
        }

        $smartyPlugins = new SmartyPlugins($container['router'], $request->getUri()->withUserInfo(null));
        $view->registerPlugin('function', 'path_for', [$smartyPlugins, 'pathFor']);
        $view->registerPlugin('function', 'base_url', [$smartyPlugins, 'baseUrl']);

        return $view;
    }
public static function create ( ContainerInterface $ container , Request $ request = null ) { if ( ! isset ( $ request ) ) { $ request = $ container [ 'request' ] ; } $ view = new Smarty ( __DIR__ . '/../templates/' ) ; if ( in_array ( 'https' , $ request -> getHeader ( 'X-Forwarded-Proto' ) ) ) { $ request = $ request -> withUri ( $ request -> getUri ( ) -> withScheme ( 'https' ) -> withPort ( 443 ) ) ; } $ smartyPlugins = new SmartyPlugins ( $ container [ 'router' ] , $ request -> getUri ( ) -> withUserInfo ( null ) ) ; $ view -> registerPlugin ( 'function' , 'path_for' , [ $ smartyPlugins , 'pathFor' ] ) ; $ view -> registerPlugin ( 'function' , 'base_url' , [ $ smartyPlugins , 'baseUrl' ] ) ; return $ view ; }
Create Smarty view object.

@param ContainerInterface $container Slim dependency container
@param Request            $request   PSR-7 request

@return Smarty
Create Smarty view object .