Renders a view

@param string $template The template name

@return string
347899
public function render($template)
    {
        $debug = defined('WP_DEBUG') ? WP_DEBUG : false;

        if (is_writable('/tmp')) {
            if (!is_dir(self::CACHE_DIR)) {
                mkdir(self::CACHE_DIR);
            }
            $cache = self::CACHE_DIR;
        } else {
            $cache = null;
        }

        Twig_Autoloader::register();

        $loader = new Twig_Loader_Filesystem([
            $this->paths->getThemeViewsDir(),
            $this->paths->getBaseViewsDir()
        ]);

        $twig = new Twig_Environment($loader, [
            'auto_reload'      => $debug,
            'cache'            => $cache,
            'charset'          => 'UTF-8',
            'debug'            => $debug,
            'strict_variables' => $debug
        ]);

        $view = $twig->loadTemplate(sprintf('%s.html.twig', $template));

        return $view->render([
            'view'  => new ViewModel($template),
            'posts' => new PostIterator(),
            'wp'    => new WordPressProxy()
        ]);
    }
941603
protected function render(Template $template)
    {
        $presenter = $this->createPresenter($template->getPresenter());

        try {
            $arguments = $this->getArguments($presenter, $template);
            $this->logger->debug($arguments);
            $result = call_user_func_array($presenter, $arguments);
        } catch(Exception $e) {
            if ($this->throwRenderExceptions) {
                throw $e;
            }

            $this->logger->error($e->getMessage() .
                    "\n\nURL: " . URLUtils::fullUrl() .
                    "\n\nTemplate:\n" . print_r($template, true) .
                    (isset($arguments) ? "\n\n$presenter args:\n" . print_r($arguments, true) : '')
                );

            $result = '';
        }

        return $result;
    }
1018370
public function showAction(Template $template)
    {
        //add the view to twig
        $this->get('twig')->addGlobal('view', $template);
        $template->setReference(new ViewReference($template->getId()));
        $event = new TemplateMenuContextualEvent($template);

        $eventName = 'victoire_core.'.Template::TYPE.'_menu.contextual';

        $this->get('event_dispatcher')->dispatch($eventName, $event);

        //the victoire templating
        $templating = $this->container->get('templating');
        $layout = $template->getLayout().'.html.twig';

        $parameters = [
            'view'                            => $template,
            'id'                              => $template->getId(),
            'locale'                          => $template->getCurrentLocale(),
            'victoire_i18n_available_locales' => $this->getParameter('victoire_i18n.available_locales'),
            'victoire_twig_responsive'        => $this->getParameter('victoire_twig.responsive'),
        ];

        $this->get('victoire_widget_map.builder')->build($template);
        $this->get('victoire_widget_map.widget_data_warmer')->warm(
            $this->get('doctrine.orm.entity_manager'),
            $template
        );

        $this->container->get('victoire_core.current_view')->setCurrentView($template);

        //create the response
        $response = $templating->renderResponse(
            'VictoireCoreBundle:Layout:'.$layout,
            $parameters
        );

        return $response;
    }
955489
public function render($template)
    {
        $template = "{$this->directory}/{$template}";
        
        ob_start();
        ob_implicit_flush();
        
        /** @var string $template */
        if (file_exists($template)) {
            extract($this->data->toArray());
            include $template;
        } else {
            return "/** [$template] */";
        }
        
        return ob_get_clean();
    }
106691
private function resolveTemplate($template)
    {
        $template = str_replace(
            getcwd(),
            '',
            $this->viewResolver->resolve($template)
        );
        return $template;
    }
468613
public function render($template)
    {
        $actions = $this->getActions();
        $this->flushActions();

        return $this->table->getRender()->getTwig()->render($template, ['actions' => $actions]);
    }
1267502
public static function Render($template=null, $data=null)
    {
        if ($template && $data) {
            return self::$renderer->render($template, $data);
        } else {
            self::$data = self::getData();
            self::$templates[] = "index";
            self::loadTemplate(self::$templates);
        }
    }
1292625
protected function getTemplate($template)
    {
        $source = __DIR__.'/../../templates/'.$template;
        return file_exists($source) ? file_get_contents($source) : null;
    }
1130489
public function view($template, $slots = []) {

        $this->trigger('app.render.view', [&$template, &$slots]);

        if (\is_string($template) && $template) {
            $this->trigger("app.render.view/{$template}", [&$template, &$slots]);
        }

        $renderer     = $this->renderer;
        $olayout      = $this->layout;

        $slots        = \array_merge($this->viewvars, $slots);
        $layout       = $olayout;

        $this->layout = false;

        if (\strpos($template, ' with ') !== false ) {
            list($template, $layout) = \explode(' with ', $template, 2);
        }

        if (\strpos($template, ':') !== false && $file = $this->path($template)) {
            $template = $file;
        }

        $slots['extend'] = function($from) use(&$layout) {
            $layout = $from;
        };

        if (!\file_exists($template)) {
            return "Couldn't resolve {$template}.";
        }

        $output = $renderer->file($template, $slots);

        if ($layout) {

            if (\strpos($layout, ':') !== false && $file = $this->path($layout)) {
                $layout = $file;
            }

            if(!\file_exists($layout)) {
                return "Couldn't resolve {$layout}.";
            }

            $slots['content_for_layout'] = $output;

            $output = $renderer->file($layout, $slots);
        }

        $this->layout = $olayout;

        return $output;
    }
1255093
private function _renderTemplate($template = null)
    {
        // when no template, auto generate template path.
        // View/Content/[controller]/[action].html.twig
        $def = $this->actionChain->getCurrentAction();
        if (! $template) {
            $controller = join(DS, array_map('ucfirst', explode('_', $def['controller_name'])));
            $action = $def['action'];
            $template = sprintf('%s/%s.%s', $controller, substr($this->actionChain->actionNameStrategy($action), 0, -6), $this->renderer->getSuffix());
        }

        // rendering by renderer.
        $def['controller']->beforeRenderer();
        $result = $this->renderer->render($template);
        $this->response->setBody($result);
        if ($this->response->isHttp()) {
            $this->response->setHeader('content-type', sprintf('text/html; charset=%s', $this->application->config('encoding.output')));
        }
    }
277235
public function render($template, array $params = [])
    {
        return $this->write($this->app->getView()->render($template, $params));
    }
631363
public function render($template) {
		$environment = [
			'post' => $_POST,
			'get' => $_GET,
			'cookie' => $_COOKIE,
			'server' => $_SERVER,
		];

		$environment = array_merge($environment, $this->environment);

		if ($this->i18n_available === true and $this->translation !== null) {
			$environment['translation'] = $this->translation;
			$environment['language'] = $this->translation->language;
		}

		if (isset($_SESSION)) {
			$environment['session'] = $_SESSION;
		}
		$this->twig->setLoader($this->filesystem_loader);
		$this->twig->addGlobal('env', $environment);
		return $this->twig->render($template, $this->variables);
	}
543638
public function setTemplate($template)
    {
        $this->templatePath = $this->getTemplatesDirectory() . '/' . ltrim($template, '/');
        if (!file_exists($this->templatePath)) {
            throw new \RuntimeException('View cannot render template `' . $this->templatePath . '`. Template does not exist.');
        }
    }
651709
public function template_include( $template ) {

		if ( '.twig' === substr( $template, - 5 ) ) {
			/** @var \Twig_Environment $twig */
			$twig = $this['twig.environment'];

			echo $twig->render( basename( $template ), apply_filters( 'meadow_context', array() ) );

			die();
		}

		return $template;
	}
738766
private function _renderTemplate($template, $vars)
	{
		extract($vars, EXTR_SKIP);
		ob_start();

		try
		{
			require($template);
			$contents = ob_get_contents();
		}
		catch (Exception $e)
		{
			// TODO: come up with a clever way of chaining exceptions
			ob_end_clean();
			throw $e;
		}

		ob_end_clean();
		return $contents;
	}
1081014
public function render(\Laasti\Views\Template $template)
    {
        return $this->mustache->render($template->getView(), $template->getData());
    }
899961
protected function renderTemplate($template)
    {
        // Build allowed extensions
        $allowedExtensions = new ArrayList();
        foreach (File::getAllowedExtensions() as $extension) {
            if ($extension) {
                $allowedExtensions->push(new ArrayData([
                    'Extension' => preg_quote($extension)
                ]));
            }
        }

        Config::nest();
        Config::modify()->set(SSViewer::class, 'source_file_comments', false);

        $viewer = SSViewer::create([$template]);
        $result = (string)$viewer->process(new ArrayData([
            'AllowedExtensions' => $allowedExtensions
        ]));

        Config::unnest();

        return $result;
    }