Outputs another template.

@param string $template path to the template
@param array|null $variables template variables
558471
public function include(string $template, array $variables = null): void
    {
        $renderer = new Renderer($this->resolve, $this->sections);
        echo $renderer->render($template, $variables);
    }
1346662
public function render($template, array $additionalVariables = null)
    {
        $variables = $this->getVariables();

        // Pass the helper to the template:
        $variables["tpl"] = $this;

        if ($additionalVariables !== null) {
            $variables = array_replace($variables, $additionalVariables);
        }

        call_user_func(function () {
            extract(func_get_arg(1));
            require func_get_arg(0);
        }, $template, $variables);
    }
930729
public function render($template, array $localVariables = array())
    {
        $view = $this->getView();

        if ($view->getLayout()) {
            $content = $view->renderWithLayout($template, $localVariables);
        } else {
            $content = $view->render($template, $localVariables);
        }

        $this->getResponse()->setBody($content);

        return $this;
    }
169811
public function addTemplateTo($zone, $template, Array $params=array()){
		if(!isset($this->content[$zone]))
			$this->content[$zone] = array();
		$this->content[$zone][] = array('type'=>'template', 'template'=>$template, 'params'=>$params);
	}
437170
public function render(string $view, array $variables = []): string
	{
		return $this->create($view, $variables)->render();
	}
950820
public function resolve(string $template, array $variables = null) 
    {
        return [
            $this->resolvePath($template), 
            $this->resolveEnv($template, $variables)
        ];
    }
1020711
protected function _outputMessage($template) {
		if (!empty($template)) {
			$template = 'CakeTheme.' . $template;
		}
		$this->controller->layout = 'CakeTheme.error';
		try {
			$this->controller->render($template);
			$this->_shutdown();
			$this->controller->response->send();
		} catch (MissingViewException $e) {
			$attributes = $e->getAttributes();
			if (isset($attributes['file']) && strpos($attributes['file'], 'error500') !== false) {
				$this->_outputMessageSafe('error500');
			} else {
				$this->_outputMessage('error500');
			}
		} catch (MissingPluginException $e) {
			$attributes = $e->getAttributes();
			if (isset($attributes['plugin']) && $attributes['plugin'] === $this->controller->plugin) {
				$this->controller->plugin = null;
			}
			$this->_outputMessageSafe('error500');
		} catch (Exception $e) {
			$this->_outputMessageSafe('error500');
		}
	}
992665
protected function renderOutput(string $template, array $vars = [])
    {
        $tpl = $this->template . '.'. $template;

        if (view()->exists($tpl)) {
            return view($tpl, $vars)->render();
        }

        abort(404, "View named $tpl not exists.");
    }
540188
public function template($template, $data = [])
    {
        $templatePath = self::$instance->app->findTemplate($template);
        echo self::$instance->renderTemplate($templatePath, $data);
    }
46573
private function _fillTemplate($template, $values) {
		foreach ($values as $key => $value) {
			$template = str_replace($key, $value, $template);
		}

		return $template;
	}
307590
protected function renderOutput(string $template, array $vars = [])
    {
        $vars = array_merge($vars, [
            'unpublished' => Article::select(['id', 'user_id', 'state'])
            ->when('owner' != user('role'), function ($query) {
                // Show unpublished articles only to current user.
                $query->where('user_id', user('id'));
            })
            ->where('state', '<>', 'published')
            ->get(),
        ]);

        return parent::renderOutput($template, $vars);
    }
927184
protected function render($template, $args = array())
    {
        if (!is_null($this->renderTemplateSuffix)
            && !preg_match('/\.' . $this->renderTemplateSuffix . '$/', $template)
        ) {
            $template .= '.' . $this->renderTemplateSuffix;
        }
        $this->app->render($template, $args);
    }
1115954
protected function _setTemplate($template)
    {
        if ($template !== null && !($template instanceof TemplateInterface)) {
            throw $this->_createInvalidArgumentException($this->__('Invalid template'), null, null, $template);
        }

        $this->template = $template;
    }
898833
protected function renderSimpleTemplate($templatePathAndFilename, array $contextVariables)
    {
        $content = file_get_contents($templatePathAndFilename);
        foreach ($contextVariables as $key => $value) {
            $content = str_replace('{' . $key . '}', $value, $content);
        }
        return $content;
    }
712276
public function dump($template, array $vars = array(), $domain = null)
    {
        $vars['__menu__'] = $this->getMenu();
        $domain = $domain ?: $this->getDomain();
        return $this->tpl->dump($domain . $template, $vars);
    }
1055547
public function render($template = null, $vars = null)
    {
        $context = $this->_context;

        if ($vars !== null) {
            $context->vars = $vars;
        }

        if (!$template) {
            $area = $this->dispatcher->getArea();
            $controller = $this->dispatcher->getController();

            if ($area) {
                $dir = "@app/Areas/$area/Views/$controller";
            } else {
                $dir = "@views/$controller";
            }

            if (!isset($this->_dirs[$dir])) {
                $this->_dirs[$dir] = $this->filesystem->dirExists($dir);
            }

            if ($this->_dirs[$dir]) {
                $template = $dir . '/' . ucfirst($this->dispatcher->getAction());
            } else {
                $template = $dir;
            }
        }

        $this->eventsManager->fireEvent('view:beforeRender', $this);

        $context->content = $this->_render($template, $context->vars, false);

        if ($context->layout !== false) {
            $layout = $this->_findLayout();
            $context->content = $this->_render($layout, $context->vars, false);
        }

        $this->eventsManager->fireEvent('view:afterRender', $this);

        return $context->content;
    }
476581
public static function partial($template, array $vars = array())
    {
        $template = new Template($template, null, $vars);

        return trim($template->render());
    }