Render a specified view

@param  string     $page
@param  array|null $params
@return mixed

@throws $e
5577
public function render($page, array $params = null)
    {
        $this->setFile($page);

        try {
            if (! file_exists($file = $this->getFile())) {
                throw new NotFoundException("Template file couldn't be found: " . $file);
            }

            if (! empty($params)) {
                $this->assign($params);
            }
            
            $template = $this->tryCompile($file);
        } catch (Exception $e) {
            $this->flushSections();

            $this->dispatchEvent('exception', $e);

            throw $e;
        } catch (Throwable $e) {
            $this->flushSections();

            $this->dispatchEvent('fatal.error', $e);

            throw $e;
        } finally {
            $this->renderingCompleted(function () {
                $this->dispatchEvent('rendering.completed');

                $this->flushSections();

                $this->onEventEmitterEnabled(function ($emitter) {
                    $emitter->removeAllListeners();
                });

                unset($this->vars, $this->shared, $this->customDirectives); // Free the memory
            });
        }

        return $template;
    }
243063
protected function render(string $view, array $params = []): Response
    {
        $this->getTemplateEngine()->addGlobal('_request', $this->getRequest());
        $template = $this->getTemplateEngine()->render($view, $params);

        return $this->getResponse()->setContent($template);
    }
1205526
private function renderPage($layoutFile = null, $params = null)
    {
        $this->setNode($this->getObject());

        $application = $this->getApplication();
        // Rendering subcontent
        if (null !== $contentSet = $this->getObject()->getContentSet()) {
            $bbUserToken = $application->getBBUserToken();
            $revisionRepo = $application->getEntityManager()->getRepository('BackBee\ClassContent\Revision');
            if (null !== $bbUserToken && null !== $revision = $revisionRepo->getDraft($contentSet, $bbUserToken)) {
                $contentSet->setDraft($revision);
            }

            $layout = $this->getObject()->getLayout();
            $zones = $layout->getZones();
            $zoneIndex = 0;

            foreach ($contentSet->getData() as $content) {
                if (array_key_exists($zoneIndex, $zones)) {
                    $zone = $zones[$zoneIndex];
                    $isMain = null !== $zone && property_exists($zone, 'mainZone') && true === $zone->mainZone;
                    $this->container()->add($this->render($content, $this->getMode(), array(
                        'class' => 'rootContentSet',
                        'isRoot' => true,
                        'indexZone' => $zoneIndex++,
                        'isMainZone' => $isMain,
                    ), null, $this->_ignoreIfRenderModeNotAvailable));
                }
            }
        }

        // Check for a valid layout file
        $this->templateFile = $layoutFile;
        if (null === $this->templateFile) {
            $this->templateFile = $this->getLayoutFile($this->getCurrentPage()->getLayout());
        }

        if (!$this->isValidTemplateFile($this->templateFile, true)) {
            throw new RendererException(
                sprintf('Unable to read layout %s.', $this->templateFile), RendererException::LAYOUT_ERROR
            );
        }

        $application->info(sprintf('Rendering page `%s`.', $this->getObject()->getNormalizeUri()));

        return $this->renderTemplate(false, true);
    }
450880
public function render($name, $params = [])
    {
        if (isset($this->fullQualifiedPathNameWithTemplatePath[$name])) {
            $template   = $this->getNewTemplate();
            $path       = $this->fullQualifiedPathNameWithTemplatePath[$name];

            $template->setFilePath($path->getPath() . '.phtml');

            if ($this->defaultParametersProvided) {
                $template->assignMany($this->defaultParameters);
            }

            if (isset($this->fullQualifiedPathNameWithDefaultParameters[$name])) {
                $template->assignMany($this->fullQualifiedPathNameWithDefaultParameters[$name]);
            }

            if (!empty($params)) {
                $template->assignMany($params);
            }

            $content = $template->render();
        } else {
            $content = '';
        }

        return $content;
    }
867759
protected function renderPartial(string $view, array $params = []): string
    {
        $this->getTemplateEngine()->addGlobal('_request', $this->getRequest());

        return $this->getTemplateEngine()->render($view, $params);
    }
657509
public function render($view, array $parameters = [], Response $response = null)
    {
        return $this->templating->renderResponse($view, $parameters, $response);
    }
778000
public function render($view, $params = array(), $output = false) {
        if (filter_var(get_config('debug'), FILTER_VALIDATE_BOOLEAN)) {
            $debugbarRenderer = Debugger::runDebuger($view);
            $this->share(['debugbarRenderer' => $debugbarRenderer]);
        }

        new Qt_View(RouteController::$currentRoute);
        Qt_View::render($view, $params, $output, $this->sharedData);
    }
1305844
public function render($name, $params = array (), $content = null)
	{
		// Initialise variables.
		$buffer = array();
		$lists  = array();

		// Get the message queue
		$messages = \App::get('notification')->messages();

		// Build the sorted message list
		if (is_array($messages) && !empty($messages))
		{
			foreach ($messages as $msg)
			{
				if (isset($msg['type']) && isset($msg['message']))
				{
					$lists[$msg['type']][] = $msg['message'];
				}
			}
		}

		$lnEnd = $this->doc->_getLineEnd();
		$tab   = $this->doc->_getTab();

		// Build the return string
		$buffer[] = '<div id="system-message-container">';

		// If messages exist render them
		if (!empty($lists))
		{
			$buffer[] = $tab . '<dl id="system-message">';
			foreach ($lists as $type => $msgs)
			{
				if (count($msgs))
				{
					$buffer[] = $tab . $tab . '<dt class="' . strtolower($type) . '">' . \App::get('language')->txt($type) . '</dt>';
					$buffer[] = $tab . $tab . '<dd class="' . strtolower($type) . ' message">';
					$buffer[] = $tab . $tab . $tab . '<ul>';
					foreach ($msgs as $msg)
					{
						$buffer[] = $tab . $tab . $tab . $tab . '<li>' . $msg . '</li>';
					}
					$buffer[] = $tab . $tab . $tab . '</ul>';
					$buffer[] = $tab . $tab . '</dd>';
				}
			}
			$buffer[] = $tab . '</dl>';
		}

		$buffer[] = '</div>';

		return implode($lnEnd, $buffer);
	}
227010
public function render($name, $params = null, $options = null)
    {
        return $this->get($name, $options)->render($params);
    }
314015
public function redirect($page, array $params = null, $forceReload = null) {
        $forceReload = (boolean) $forceReload;
        $url = $this->getRender()->getUrlPage($page, $params);
        $this->redirectUrl($url, $forceReload);
    }
880825
public function render($matchedURITemplate, array $params = array())
    {
        // For current URI template
        $options = $this->mapManager->getDataByUriTemplate($matchedURITemplate);

        $class = $this->mapManager->getControllerByURITemplate($matchedURITemplate);
        $action = $this->mapManager->getActionByURITemplate($matchedURITemplate);

        return $this->call($class, $action, $params, $options);
    }
1259002
public function render($template, PageInterface $page = null)
    {
        if (!$template) {
            return null;
        }

        $twigTemplate = $this->twig->createTemplate($template);

        return $twigTemplate->render([
            'node' => $page,
        ]);
    }
280918
function Render()
    {
        self::$currentPage = $this->page;
        self::$Title = self::$currentPage->GetTitle();
        self::$Description = self::$currentPage->GetDescription();
        self::$Keywords = self::$currentPage->GetKeywords();
        if ($this->page->GetType() == (string)PageType::NotFound())
        {
            header('HTTP/1.0 404 Not Found');
        }
        else if ($this->page->GetType() !== (string)PageType::Normal())
        {
            throw new \Exception('Internal phine error: not normal page called');
        }
        ob_start();
        require PathUtil::LayoutTemplate($this->layout);
        $result = ob_get_clean();
        $replacer = new Replacer();
        return $replacer->RealizeVariables($result);
    }
996642
public function render($view, array $parameters = array(), Response $response = null)
    {
        if ($response === null) {
            $response = new Response();
        }

        $json = Encoder::encodeFromFile($this->getPath($view), $parameters);
        $response->setContent($json);

        return $response;
    }
1304617
protected function renderPage($page, $options = array()) {
        $this->render(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . $page . '.php', $options);
    }
438941
public function renderPage($view, $layout = null)
    {
        $event = new PageMenuContextualEvent($view);

        //Set currentView and dispatch victoire.on_render_page event with this currentView
        $pageRenderEvent = new PageRenderEvent($view);
        $this->eventDispatcher->dispatch('victoire.on_render_page', $pageRenderEvent);
        $this->currentViewHelper->setCurrentView($view);

        //Build WidgetMap
        $this->widgetMapBuilder->build($view, true);

        //Populate widgets with their data
        $this->widgetDataWarmer->warm($this->entityManager, $view);

        //Dispatch contextual event regarding page type
        if (in_array($view->getType(), ['business_page', 'virtual_business_page'])) {
            //Dispatch also an event with the Business entity name
            $eventName = 'victoire_core.page_menu.contextual';
            if (!$view->getId()) {
                $eventName = 'victoire_core.business_template_menu.contextual';
                $event = new PageMenuContextualEvent($view->getTemplate());
            }
            $this->eventDispatcher->dispatch($eventName, $event);
            $type = $view->getBusinessEntityId();
        } else {
            $type = $view->getType();
        }

        $eventName = 'victoire_core.'.$type.'_menu.contextual';
        $this->eventDispatcher->dispatch($eventName, $event);

        if (null === $layout) {
            //Determine which layout to use
            $layout = $this->guessBestLayoutForView($view);
        }
        $globalConfig = $this->entityManager->getRepository(GlobalConfig::class)->findLast() ?: new GlobalConfig();

        //Create the response
        $response = $this->container->get('templating')->renderResponse('VictoireCoreBundle:Layout:'.$layout.'.html.twig', [
            'globalConfig'                    => $globalConfig,
            'victoire_i18n_available_locales' => $this->availableLocales,
            'victoire_twig_responsive'        => $this->twigResponsive,
            'view'                            => $view,
        ]);

        return $response;
    }
233824
public function showAction(ErrorPage $page)
    {
        //add the view to twig
        $this->container->get('twig')->addGlobal('view', $page);
        $page->setReference(new ViewReference($page->getId()));
        $parameters = [
            'view'   => $page,
            'id'     => $page->getId(),
            'locale' => $page->getCurrentLocale(),
        ];

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

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

        //create the response
        $response = $this->container->get('templating')->renderResponse(
            'VictoireCoreBundle:Layout:'.$page->getTemplate()->getLayout().'.html.twig',
            $parameters
        );

        return $response;
    }