public function finder(Page $page, Config $config)
    {
        $layout = 'unknown';

        // what layouts could be use for the page?
        $layouts = self::fallback($page);

        // take the first available layout
        foreach ($layouts as $layout) {
            // is it in layouts/ dir?
            if (Util::getFS()->exists($config->getLayoutsPath().'/'.$layout)) {
                return $layout;
            }
            // is it in <theme>/layouts/ dir?
            if ($config->hasTheme()) {
                $themes = $config->getTheme();
                foreach ($themes as $theme) {
                    if (Util::getFS()->exists($config->getThemeDirPath($theme, 'layouts').'/'.$layout)) {
                        return $layout;
                    }
                }
            }
            // is it in res/layouts/ dir?
            if (Util::getFS()->exists($config->getInternalLayoutsPath().'/'.$layout)) {
                return $layout;
            }
        }

        throw new Exception(sprintf("Layout '%s' not found for page '%s'!", $layout, $page->getId()));
    }
public function finder(Page $page, Config $config)
    {
        $layout = 'unknown';

        // what layouts could be use for the page?
        $layouts = self::fallback($page);

        // take the first available layout
        foreach ($layouts as $layout) {
            // is it in layouts/ dir?
            if (Util::getFS()->exists($config->getLayoutsPath().'/'.$layout)) {
                return $layout;
            }
            // is it in <theme>/layouts/ dir?
            if ($config->hasTheme()) {
                $themes = $config->getTheme();
                foreach ($themes as $theme) {
                    if (Util::getFS()->exists($config->getThemeDirPath($theme, 'layouts').'/'.$layout)) {
                        return $layout;
                    }
                }
            }
            // is it in res/layouts/ dir?
            if (Util::getFS()->exists($config->getInternalLayoutsPath().'/'.$layout)) {
                return $layout;
            }
        }

        throw new Exception(sprintf("Layout '%s' not found for page '%s'!", $layout, $page->getId()));
    }
public function finder ( Page $ page , Config $ config ) { $ layout = 'unknown' ; // what layouts could be use for the page? $ layouts = self :: fallback ( $ page ) ; // take the first available layout foreach ( $ layouts as $ layout ) { // is it in layouts/ dir? if ( Util :: getFS ( ) -> exists ( $ config -> getLayoutsPath ( ) . '/' . $ layout ) ) { return $ layout ; } // is it in <theme>/layouts/ dir? if ( $ config -> hasTheme ( ) ) { $ themes = $ config -> getTheme ( ) ; foreach ( $ themes as $ theme ) { if ( Util :: getFS ( ) -> exists ( $ config -> getThemeDirPath ( $ theme , 'layouts' ) . '/' . $ layout ) ) { return $ layout ; } } } // is it in res/layouts/ dir? if ( Util :: getFS ( ) -> exists ( $ config -> getInternalLayoutsPath ( ) . '/' . $ layout ) ) { return $ layout ; } } throw new Exception ( sprintf ( "Layout '%s' not found for page '%s'!" , $ layout , $ page -> getId ( ) ) ) ; }
Layout file finder.

@param Page   $page
@param Config $config

@throws Exception

@return string
Layout file finder .