Пример #1
0
 static function get_partial_template($name)
 {
     # return contents of partial file, or return 'not found' error (as text)
     if (!self::$partials) {
         self::$partials = Helpers::rglob('./templates/partials*/*.*');
     }
     foreach (self::$partials as $partial) {
         if (preg_match('/([^\\/]+?)\\.[\\w]+?$/', $partial, $file_name)) {
             if ($file_name[1] == $name) {
                 return file_get_contents($partial);
             }
         }
     }
     return 'Partial \'' . $name . '\' not found';
 }