public static function renderLayout($layout, $content, $vars = array(), $dirs = null)
    {
        $dirs = $dirs ?: self::get('atomik.dirs.layouts');
        if (is_array($layout)) {
            foreach (array_reverse($layout) as $l) {
                $content = self::renderLayout($l, $content, $vars, $dirs);
            }
            return $content;
        }
        
        // allows rendered files to dynamically add layouts
        $appLayout = self::delete('app.layout');
        self::set('app.layout', array($layout));
        
        do {
            $layout = array_shift(self::getRef('app.layout'));
            self::fireEvent('Atomik::Renderlayout', array(&$layout, &$content, &$vars, &$dirs));
            $vars['contentForLayout'] = $content;
            $content = self::render($layout, $vars, $dirs);
        } while (count(self::get('app.layout')));
        
        self::set('app.layout', $appLayout);
        return $content;
    }
public static function renderLayout($layout, $content, $vars = array(), $dirs = null)
    {
        $dirs = $dirs ?: self::get('atomik.dirs.layouts');
        if (is_array($layout)) {
            foreach (array_reverse($layout) as $l) {
                $content = self::renderLayout($l, $content, $vars, $dirs);
            }
            return $content;
        }
        
        // allows rendered files to dynamically add layouts
        $appLayout = self::delete('app.layout');
        self::set('app.layout', array($layout));
        
        do {
            $layout = array_shift(self::getRef('app.layout'));
            self::fireEvent('Atomik::Renderlayout', array(&$layout, &$content, &$vars, &$dirs));
            $vars['contentForLayout'] = $content;
            $content = self::render($layout, $vars, $dirs);
        } while (count(self::get('app.layout')));
        
        self::set('app.layout', $appLayout);
        return $content;
    }
public static function renderLayout ( $ layout , $ content , $ vars = array ( ) , $ dirs = null ) { $ dirs = $ dirs ? : self :: get ( 'atomik.dirs.layouts' ) ; if ( is_array ( $ layout ) ) { foreach ( array_reverse ( $ layout ) as $ l ) { $ content = self :: renderLayout ( $ l , $ content , $ vars , $ dirs ) ; } return $ content ; } // allows rendered files to dynamically add layouts $ appLayout = self :: delete ( 'app.layout' ) ; self :: set ( 'app.layout' , array ( $ layout ) ) ; do { $ layout = array_shift ( self :: getRef ( 'app.layout' ) ) ; self :: fireEvent ( 'Atomik::Renderlayout' , array ( & $ layout , & $ content , & $ vars , & $ dirs ) ) ; $ vars [ 'contentForLayout' ] = $ content ; $ content = self :: render ( $ layout , $ vars , $ dirs ) ; } while ( count ( self :: get ( 'app.layout' ) ) ) ; self :: set ( 'app.layout' , $ appLayout ) ; return $ content ; }
Renders a layout

@param string $layout Layout name
@param string $content The content that will be available in the layout in the $contentForLayout variable
@param array $vars An array containing key/value pairs that will be transformed to variables accessible inside the layout
@param array $dirs Directories where to search for layouts
@return string
Renders a layout