示例#1
0
 /**
  * Render page layout
  *
  * @param string      $fileName
  * @param null|string $path
  * @param array       $params
  *
  * @throws N2ViewException
  */
 protected function renderLayout($fileName, $params = array(), $path = null)
 {
     if (is_null($path)) {
         $path = $this->appType->path . NDS . "layouts" . NDS;
     } else {
         if (strpos(".", $path)) {
             $path = N2Filesystem::dirFormat($path);
         }
     }
     if (!N2Filesystem::existsFile($path . $fileName . ".php")) {
         throw new N2ViewException("Layout file ({$fileName}.php) not found in '{$path}'");
     }
     extract($params);
     /** @noinspection PhpIncludeInspection */
     include $path . $fileName . ".php";
 }