public function render($template = [], $data = null) { if (is_string($template)) { return parent::render($template, $data); } return json_encode($this->data[0]); }
/** * Render template * @var string Template to be rendered (optional) */ public function render($template = '') { $template = is_string($template) ? $template . '.php' : null; if ($template) { $this->appendData(array('global' => $this->global)); $content = parent::render($template); } else { $content = ''; } // make sure buffers flushed ob_end_flush(); if (ob_get_length() !== false) { ob_flush(); } ob_start(); extract(array('content' => $content, 'global' => $this->global)); if ($this->layout) { $layoutPath = $this->getTemplatesDirectory() . '/' . ltrim($this->layout, '/'); if (!is_readable($layoutPath)) { throw new RuntimeException('View cannot render layout `' . $layoutPath); } require $layoutPath; } else { echo $content; } return ob_get_clean(); }
protected function render($template, $data = null) { $contents = parent::render($template, $data); if (is_null($this->layoutFile)) { return $contents; } else { return parent::render('layout.php', array('contents' => $contents, 'title' => $this->htmlTitle)); } }
public function render($template, $data = NULL) { if ($this->layout) { $_html = parent::render($template); $this->set('_html', $_html); $template = $this->layout; $this->layout = null; } return parent::render($template); }
public function render($template, $data = null) { if (!is_array($data)) { $data = (array) $data; } if (isset($data['noWrapper'])) { return parent::render($template, $data); } else { $data['view'] = $this; $data['template'] = $template; return parent::render("decorator/decorator.phtml", $data); } }
/** * Our (marginally) smarter render function. The layout can be changed by * setting a "_layout" data key to the new layout file, or boolean false to * disable layout. * * @param string $template template name * @return string rendered template */ public function render($template) { $env = \Slim\Environment::getInstance(); $this->setData('_base', $env['SCRIPT_NAME']); $data = $this->getData(); if (isset($data['_layout'])) { $layout = $data['_layout']; } else { $layout = $this->layout; } $content = parent::render($template); if ($layout !== false) { $this->setData($data); $this->setData('content', $content); $content = parent::render($layout); } return $content; }
/** * Render template * @var string $template Template to be rendered */ public function render($template = '', $data = null) { $template = is_string($template) ? $template . '.php' : null; if ($template) { $this->appendData(array('global' => $this->global)); $content = parent::render($template); } else { $content = ''; } extract(array('content' => $content, 'global' => $this->global)); if ($this->layout) { $layoutPath = $this->getTemplatesDirectory() . DIRECTORY_SEPARATOR . ltrim($this->layout, '/'); if (!is_readable($layoutPath)) { throw new \RuntimeException('View cannot render layout `' . $layoutPath); } require $layoutPath; } else { echo $content; } }
public function render($template) { $this->setData('childView', $template); $template = $this->masterTemplate; return parent::render($template); }
function getOutput($template, $data = array()) { $this->setData($data); return parent::render($template); }
protected function render($template, $data = null) { return parent::render($template . '.php', $data); }
/** * Renders template and injects it to the layout file. * * @param string $template * @param array $data * @return string */ public function render($template, $data = null) { return parent::render($template, $data); }
public function render($template, $data = null) { $content = parent::render($template); return parent::render('admin/layout.php', array('content' => $content)); }
/** * Automatically include header and footer when rendering a template * * @see Slim_View::render() */ public function render($template) { return parent::render('json' . DS . $template); }
/** * @see \Slim\View::render() */ public function render($template) { return parent::render($template); }
public function render($template, $data = null) { $format = 'html'; if (!empty($_SERVER['HTTP_ACCEPT'])) { $negotiator = new FormatNegotiator(); $format = $negotiator->getBestFormat($_SERVER['HTTP_ACCEPT'], array('html', 'json')); } if ('json' === $format) { return json_encode($this->data->all()); } $helpers_file = $this->getTemplatePath('helpers.php'); if (is_file($helpers_file)) { $app = $this->app; require_once $helpers_file; } $resources = $this->resources; foreach ($resources as $resource_type => $resource_paths) { foreach ($resource_paths as $i => $resource_path) { // Ignore absolute URLs. if (preg_match('/^[a-z]*:?\\/\\//', $resource_path)) { continue; } $resources[$resource_type][$i] = $this->getResourceUrl($resource_path); } } $header = parent::render('header.php', array('resources' => $resources)); $footer = parent::render('footer.php'); return $header . parent::render($template . '.php') . $footer; }
public function render($template) { $this->setData('childView', $template); $this->injectDefaultVariables(); return parent::render($this->masterTemplate); }
public function partial($template, $data = array()) { return parent::render($template, array_merge($this->layoutData, (array) $data)); }
public function render($template, $data = null) { return $this->renderLayout(parent::render($template, $data)); }