Instantiates a new ViewResponse
@param TemplateEngineInterface $template
@param string $view
@param array $viewdata
@param int $status
@param array $headers
@return \static
@throws InvalidArgumentException
439923
public static function create($template = null, $view = '', $viewdata = [], $status = 200, $headers = array())
    {
        if (!$template instanceof TemplateEngineInterface) {
            throw new InvalidArgumentException('The first argument of ViewResponse::create must be an instance of Laasti\Response\Engines\TemplateEngineInterface');
        }
        return new static($template, $view, $viewdata, $status, $headers);
    }
72336
public function render(TemplateView $view)
    {
        $content = $this->twig->render($view->getTemplate(), $view->getContext()->toArray());

        $response = new TemplateResponse($view->getTemplate(), $view->getContext(), $content);

        return $response;
    }
662057
public function prepareTemplateParameters(View $view)
    {
        $data = $view->getData();

        if ($data instanceof FormInterface) {
            $data = [$view->getTemplateVar() => $data->getData(), 'form' => $data];
        } elseif (empty($data) || !is_array($data) || is_numeric((key($data)))) {
            $data = [$view->getTemplateVar() => $data];
        }

        if (isset($data['form']) && $data['form'] instanceof FormInterface) {
            $data['form'] = $data['form']->createView();
        }

        $templateData = $view->getTemplateData();
        if (is_callable($templateData)) {
            $templateData = call_user_func($templateData, $this, $view);
        }

        return array_merge($data, $templateData);
    }
594112
public function renderView($viewVariables, $template)
    {
        $encoder = $this->handler->getEncoder();
        if (method_exists($encoder, 'renderView')) {
            return $encoder->renderView(
                $template,
                array_merge($this->viewContext, (array)$viewVariables)
            );
        } else {
            throw new Exception('The current encoder does not support the render view method.');
        }
    }
752311
public function render($template, array $data = [])
    {
        $isString = is_string($template);

        if ($isString && is_file($template)) {
            return $this->renderTemplate($template, $data);
        }
        if (! $isString && ! is_array($template)) {
            throw new InvalidArgumentException('Template must be a string or an array of strings.');
        }
        $path = $this->find($template);
        if ($path) {
            return $this->doRender($path, $data);
        }
        if ($isString) {
            throw new RuntimeException($template.' is not a valid template name.');
        }

        throw new RuntimeException('Not found any valid template in the array provided.');
    }
908193
public function template($template, $data = Array()){
        \Template::with($template, $data);
        \View::serve();
    }
94869
public function render($template, $data = null)
    {
        $this->templateName = $template;
        $this->templateFile = $this->getTemplatePathname($template);

        if (!is_file($this->templateFile))
        {
            throw new \RuntimeException("Slimore\\Mvc\\View cannot render `$template` because the template does not exist");
        }

        $this->setCompileDirectory();
        $this->setCompileFile($template);

        ob_start();

        $data = array_merge($this->data->all(), (array) $data);
        $data = array_merge(static::$globals, $data);

        static::getProperties([
            'data'               => $data,
            'compileCached'      => $this->compileCached,
            'templatePath'       => $this->getTemplatesDirectory() . DIRECTORY_SEPARATOR,
            'compilePath'        => $this->compilePath,
            'compileFileNameMd5' => $this->compileFileNameMd5,
            'compileFileSuffix'  => $this->compileFileSuffix
        ]);

        extract($data);

        //echo "this->compileCached =>" . ($this->compileCached ? 'true' : 'false');

        if (!$this->compileCached)
        {
            $tpl = $this->read($this->templateFile);
            $tpl = static::parser($tpl);
            $this->write($this->templateCompileFile, $tpl);
        }
        else
        {
            if (!file_exists($this->templateCompileFile) ||
                (filemtime($this->templateFile) > filemtime($this->templateCompileFile))
            ) {
                $tpl = $this->read($this->templateFile);
                $tpl = static::parser($tpl);
                $this->write($this->templateCompileFile, $tpl);
            }
        }

        require $this->templateCompileFile;

        echo ob_get_clean();
    }
340409
public function renderResponse($view, $params = [])
    {
        /** @var \DevGroup\AdminUtils\controllers\BaseController $context */
        $context = $this instanceof Action ? $this->controller : $this;
        if (Yii::$app->request->isAjax === true) {
            Yii::$app->response->format = Response::FORMAT_JSON;

            $content = $context->renderAjax($view, $params);
            return new AjaxResponse($content, false, Yii::$app->session->getAllFlashes(true));
        } else {
            return $context->render($view, $params);
        }
    }
1151771
private function renderTemplate($viewType, array $templateParams = [], $widget = false)
    {
        $template = $widget && !empty($this->configuration['view'][$viewType]['template'])
            ? $this->configuration['view'][$viewType]['template']
            : sprintf('DarvinAdminBundle:Crud%s:%s.html.twig', $widget ? '/widget' : '', $viewType);

        return $this->renderView($template, $templateParams);
    }
1056814
protected function renderResponse($view, array $parameters = array(), Response $response = null)
    {
        return $this->get('templating')->renderResponse($view, $parameters, $response);
    }
1055705
public function render(View $view)
    {
        $this->eventDispatcher->dispatch(
            MVCEvents::PRE_CONTENT_VIEW,
            new PreContentViewEvent($view)
        );

        $templateIdentifier = $view->getTemplateIdentifier();
        if ($templateIdentifier instanceof Closure) {
            return $templateIdentifier($view->getParameters());
        }

        if ($view->getTemplateIdentifier() === null) {
            throw new NoViewTemplateException($view);
        }

        return $this->templateEngine->render(
            $view->getTemplateIdentifier(),
            $view->getParameters()
        );
    }
786127
protected function initializeView(ViewInterface $view)
    {
        parent::initializeView($view);

        // Early return for actions without valid view like tcaCreateAction or tcaDeleteAction
        if (!($this->view instanceof BackendTemplateView)) {
            return;
        }

        // Hand over flash message queue to module template
        $this->view->getModuleTemplate()->setFlashMessageQueue($this->controllerContext->getFlashMessageQueue());
        $this->view->assign('actions', ['index', 'typography', 'tca', 'trees', 'tab', 'tables', 'avatar', 'buttons',
            'infobox', 'flashMessages', 'icons', 'debug', 'helpers', 'modal']);
        $this->view->assign('currentAction', $this->request->getControllerActionName());

        // Shortcut button
        $buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();
        $getVars = $this->request->getArguments();
        $extensionName = $this->request->getControllerExtensionName();
        $moduleName = $this->request->getPluginName();
        if (count($getVars) === 0) {
            $modulePrefix = strtolower('tx_' . $extensionName . '_' . $moduleName);
            $getVars = array('id', 'M', $modulePrefix);
        }
        $shortcutButton = $buttonBar->makeShortcutButton()
            ->setModuleName($moduleName)
            ->setGetVariables($getVars);
        $buttonBar->addButton($shortcutButton);
    }
278026
protected function createView(\Exception $exception, $code, array $templateData, Request $request, $showException)
    {
        $view = new View($exception, $code, $exception instanceof HttpExceptionInterface ? $exception->getHeaders() : []);
        $view->setTemplateVar('raw_exception');
        $view->setTemplateData($templateData);

        return $view;
    }
999111
public function loadView($view, $data = array(), $mergeData = array())
    {
        $this->view = View::make($view, $data, $mergeData);
        return parent::loadView($view, $data, $mergeData);
    }
804090
protected function useTemplate($template, $status = 200, $minetype = 'html') {
		// Set the HTTP header status
		$this->response()->setStatusCode($status);

		// Set the minetype
		$this->response()->headers->set('Content-Type', $this->request()->getMimeType($minetype));

		// Set the template file
		$this->response()->template = $template;
	}
1272830
public function render(string $view, array $templateVars = []): string
    {
        return $this->renderer->render($view, $templateVars);
    }
1176355
protected function createView($key, $template = 'view.php')
    {
        try {
            // Prepare
            $path = $this->rootPath.'/assets/views';
            $views = explode('.', $key);
            // Loop creation
            for ($i = 0; $i < count($views); ++$i) {
                if (count($views) - 1 == $i) {
                    // File check
                    $filename = $path.'/'.$views[$i].'.php';
                    if (!file_exists($filename))
                        file_put_contents(
                            $filename,
                            preg_replace('/\{0\}/', $key, $this->getTemplate($template))
                        );
                } else {
                    // Directory check
                    $path .= '/'.$views[$i];
                    if (!is_dir($path))
                        mkdir($path);
                }
            }
            // Print end
            $this->_print('View created!');
            $this->_lineBreak();
        } catch (Exception $e) {
            file_put_contents(
                $this->rootPath.'/error_log',
                $e->getMessage()
            );
            throw new NoticeException('Command "'.$this->key.'": Fatal error ocurred.');
        }
    }