/** * (non-PHPdoc) * @see Simplify_ViewInterface::render() */ public function render(\Simplify\RenderableInterface $object = null) { if (empty($object)) { $object = $this->object; } $template = $object->getTemplate(); if ($template === false) { return ''; } \Simplify::response()->header('Content-Type: text/html; charset=UTF-8'); $output = $this->internalRender($object, $template); $layout = $object->getLayout(); if ($layout !== false) { if (empty($layout)) { $layout = $this->getLayout(); } $view = new self(); $view->copyAll($object); $view->copyAll($this); $view->set('layout_content', $output); $view->setTemplate($layout); $view->setTemplatesPath($object->getLayoutsPath()); $view->setLayout(false); $output = $view->render(); } return $output; }
/** * @param string $title * @param string $urn * @param string|null $theme * @param string|null $layout * * @return Node */ public static function createPage($title, $urn, $theme = null, $layout = null) { $page = new self(); $page->setType(self::TYPE_PAGE); $page->setTitle($title); $page->setUrn($urn); $page->setTheme($theme); $page->setLayout($layout); return $page; }
/** * (non-PHPdoc) * @see \Simplify\ViewInterface::render() */ public function render(\Simplify\RenderableInterface $object = null) { if (empty($object)) { $object = $this->object; } $template = $object->getTemplate(); if ($template === false) { return ''; } if (sy_path_is_absolute($template)) { if (!file_exists($template)) { throw new \Exception("Template not found: <b>{$template}</b>"); } } else { $filename = $template; $path = $object->getTemplatesPath(); $template = array(); do { $template[] = array_shift($path) . '/' . $filename . '.php'; } while (count($path) && !file_exists(end($template))); if (!file_exists(end($template))) { throw new \Exception("Template not found: <b>{$filename}</b><br/><br/>Using path:<br/><b>" . implode('</b><br/><b>', $template) . "</b>"); } $template = end($template); } $output = $this->internalRender($object, $template); $layout = $object->getLayout(); if ($layout !== false) { if (empty($layout)) { $layout = $this->getLayout(); } $view = new self(); $view->copyAll($object); $view->copyAll($this); $view->set('layout_content', $output); $view->setTemplate($layout); $view->setTemplatesPath($object->getLayoutsPath()); $view->setLayout(false); $output = $view->render(); } return $output; }
/** * Create a new instance of Zend_Log_Writer_Mail * * @param array|Zend_Config $config * @return Zend_Log_Writer_Mail */ public static function factory($config) { $config = self::_parseConfig($config); $mail = self::_constructMailFromConfig($config); $writer = new self($mail); if (isset($config['layout']) || isset($config['layoutOptions'])) { $writer->setLayout($config); } if (isset($config['layoutFormatter'])) { $layoutFormatter = new $config['layoutFormatter'](); $writer->setLayoutFormatter($layoutFormatter); } if (isset($config['subjectPrependText'])) { $writer->setSubjectPrependText($config['subjectPrependText']); } return $writer; }