/** * 渲染视图模版 * * @param string $viewname * * @return string */ protected function view($viewname) { $this->viewVars['_app'] = $this->app; $this->viewVars['_vt'] = $this->getViewTools(); $viewObj = new View($this->viewDir, $viewname, $this->viewVars); return $viewObj->execute(); }
public function cmdView(App $app, $type) { if ($this->enable) { $this->enable = false; if ('json' == $type) { return $this->getContent(); } if ('ui' == $type) { $view = new View(__DIR__ . '/_asdebug', 'ui', ['url' => $app->pagePathing('asdebug'), 'qargs' => $this->qargs]); return $view->execute(); } } return 422; }
/** * 载入一个视图片段 * * @param string $viewname 视图片段名 */ function element($viewname) { $__filename = $this->view->view_filename("_elements/{$viewname}"); extract($this->view->vars); include $__filename; }