/** * (non-PHPdoc) * * @see \Slince\View\Engine\Native\ViewInterface::render() */ function render($variables = [], $useLayout = true) { $viewRender = $this->_viewManager->getViewRender(); $viewRender->set($variables); $content = ''; if (!$viewRender->hasBlock('content')) { $content = $viewRender->render($this); $block = ViewFactory::createBlock($content); $viewRender->addBlock('content', $block); } if ($useLayout && !is_null($this->_layoutFile)) { $content = $viewRender->renderFile($this->_layoutFile); } $viewRender->reset(); return $content; }
/** * 捕捉一个视图块 * * @param string $name */ function start($name) { $this->_blocks[$name] = ViewFactory::createBlock(); ob_start(); }