示例#1
0
文件: View.php 项目: pixel418/staq
 public static function findTemplate($stack, $action = NULL)
 {
     $template = strtolower(\Staq\Util::getStackSubQuery($stack, '/')) . '.twig';
     $template = str_replace('_', '/', $template);
     if (!empty($action)) {
         $template = $action . '/' . $template;
     }
     $folder = strtolower(\Staq\Util::getStackType($stack));
     while (TRUE) {
         if (\Staq::App()->getFilePath('template/' . $folder . '/' . $template)) {
             break;
         }
         if (\UString::has($template, '/')) {
             $template = \UString::substrBeforeLast($template, '/') . '.twig';
         } else {
             $template = 'index.twig';
             break;
         }
     }
     return $folder . '/' . $template;
 }