*/ private function _resolveTemplate(string $name): string { $template = $this->view->resolveTemplate($name); if ($template !== false) { return $template; } throw new TemplateLoaderException($name, Craft::t('app', 'Unable to find the template “{template}”.', ['template' => $name])); } }
* @param string $name The name of the template to load * @return string The cache key (the path to the template) * @throws TemplateLoaderException if the template doesn’t exist */ public function getCacheKey($name): string { return $this->_resolveTemplate($name); } /** * Returns whether the cached template is still up to date with the latest template. * * @param string $name The template name
* @return string The template class name * * @internal */ public function getTemplateClass($name, $index = null) { $key = $this->getLoader()->getCacheKey($name).$this->optionsHash; return $this->templateClassPrefix.hash(\PHP_VERSION_ID < 80100 ? 'sha256' : 'xxh128', $key).(null === $index ? '' : '___'.$index); } /** * Renders a template.
* @throws SyntaxError When an error occurred during compilation * * @internal */ public function loadTemplate($name, $index = null) { return $this->loadClass($this->getTemplateClass($name), $name, $index); } /** * @internal */ public function loadClass($cls, $name, $index = null)
* @inheritdoc */ public function loadTemplate($name, $index = null) { try { /** @noinspection PhpInternalEntityUsedInspection */ return parent::loadTemplate($name, $index); } catch (Error $e) { if (Craft::$app->getConfig()->getGeneral()->suppressTemplateErrors) { // Just log it and return an empty template Craft::$app->getErrorHandler()->logException($e); return Craft::$app->getView()->renderString('');
$class = substr($class, 0, $pos); } return $this->env->loadClass($class, $template, $index); } return $this->env->loadTemplate($template, $index); } catch (Error $e) { if (!$e->getSourceContext()) { $e->setSourceContext($templateName ? new Source('', $templateName) : $this->getSourceContext()); } if ($e->getTemplateLine() > 0) {
{#<form class="form" data-name="Search Form" name="search-form" action="{{ url('vakantiehuizen/filter#searchResults') }}">#} <div class="form-left"> <div class="home-search-interactive-plan w-hidden-medium w-hidden-small w-hidden-tiny"> <div> {% cache for 4 weeks %} {% include "vakantiehuizen_v2/_content/_map" %} {% endcache %} </div> </div> </div> <div class="form-right"> <h3 class="h3 search-house-home">Vind jouw vakantiehuis in Italië</h3>
if (null !== $template && !$template instanceof self) { throw new \LogicException('A block must be a method on a \Twig\Template instance.'); } if (null !== $template) { try { $template->$block($context, $blocks); } catch (Error $e) { if (!$e->getSourceContext()) { $e->setSourceContext($template->getSourceContext()); } // this is mostly useful for \Twig\Error\LoaderError exceptions
<a class="close-mobile main-nav-item w-button w-hidden-main" data-ix="close-mob-nav" href="#">Sluiten</a> </div> </div> </div> </div> <a class="go-to-top-button w-inline-block" href="#go-to-top"></a> {% block content %} {% endblock %} <div class="footer"> <div class="footer-container"> <div class="row-footer w-row"> <div class="footer-column-1 w-col w-col-7"> <div class="form-wrapper-overlay">
if (null !== $template && !$template instanceof self) { throw new \LogicException('A block must be a method on a \Twig\Template instance.'); } if (null !== $template) { try { $template->$block($context, $blocks); } catch (Error $e) { if (!$e->getSourceContext()) { $e->setSourceContext($template->getSourceContext()); } // this is mostly useful for \Twig\Error\LoaderError exceptions
<div class="cookiescontainer"> <div class="insolita-text">Insolita gebruikt cookies om uw surfervaring op deze website beter te maken.</div> <a class="button-cookies w-button" data-ix="hide-cookies" href="#">Ik ga akkoord</a> </div> </div> {% endif %} {% block body %}{% endblock %} {% block popUp %} {% endblock %} {% block bottomJs %} <!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js" type="text/javascript"></script> -->
return ob_get_clean(); } protected function displayWithErrorHandling(array $context, array $blocks = []) { try { $this->doDisplay($context, $blocks); } catch (Error $e) { if (!$e->getSourceContext()) { $e->setSourceContext($this->getSourceContext()); } // this is mostly useful for \Twig\Error\LoaderError exceptions
{ return $this->blocks; } public function display(array $context, array $blocks = []) { $this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks)); } public function render(array $context) { $level = ob_get_level(); if ($this->env->isDebug()) {
{% extends "_layouts/_base" %} {% set navs = craft.entries.section('navigatie') %} {% set topNavs = craft.entries.section('topNavigatie') %} {% set contact = craft.entries.section('contact') %} {% block body %} {# Sets a cookie to expire in an hour. #} {{ setCookie('insolita', 'insol', now | date_modify("+31 days").timestamp ) }}
return ob_get_clean(); } protected function displayWithErrorHandling(array $context, array $blocks = []) { try { $this->doDisplay($context, $blocks); } catch (Error $e) { if (!$e->getSourceContext()) { $e->setSourceContext($this->getSourceContext()); } // this is mostly useful for \Twig\Error\LoaderError exceptions
{ return $this->blocks; } public function display(array $context, array $blocks = []) { $this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks)); } public function render(array $context) { $level = ob_get_level(); if ($this->env->isDebug()) {
{% extends "_layouts/_site" %} {% block extraCSS %} {# De styling bestanden om de datepicker te stylen met jquery ui #} {% cache for 4 weeks %} <link rel="stylesheet" href="/js/jquery-ui/jquery-ui.min.css"> <link rel="stylesheet" href="/js/jquery-ui/jquery-ui.structure.min.css"> <link rel="stylesheet" href="/js/jquery-ui/jquery-ui.theme.min.css">
return ob_get_clean(); } protected function displayWithErrorHandling(array $context, array $blocks = []) { try { $this->doDisplay($context, $blocks); } catch (Error $e) { if (!$e->getSourceContext()) { $e->setSourceContext($this->getSourceContext()); } // this is mostly useful for \Twig\Error\LoaderError exceptions
{ return $this->blocks; } public function display(array $context, array $blocks = []) { $this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks)); } public function render(array $context) { $level = ob_get_level(); if ($this->env->isDebug()) {
if ($this->env->isDebug()) { ob_start(); } else { ob_start(function () { return ''; }); } try { $this->display($context); } catch (\Throwable $e) { while (ob_get_level() > $level) { ob_end_clean(); } throw $e;
* @param array $context An array of parameters to pass to the template */ public function render(array $context = []): string { // using func_get_args() allows to not expose the blocks argument // as it should only be used by internal code return $this->template->render($context, \func_get_args()[1] ?? []); } /** * Displays the template. * * @param array $context An array of parameters to pass to the template
* @throws LoaderError When the template cannot be found * @throws SyntaxError When an error occurred during compilation * @throws RuntimeError When an error occurred during rendering */ public function render($name, array $context = []) { return $this->load($name)->render($context); } /** * Displays a template. * * @param string|TemplateWrapper $name The template name
// Render and return $renderingTemplate = $this->_renderingTemplate; $this->_renderingTemplate = $template; try { $output = $this->getTwig()->render($template, $variables); } finally { $this->_renderingTemplate = $renderingTemplate; $this->setTemplateMode($oldTemplateMode); } $this->afterRenderTemplate($template, $variables, $templateMode, $output);
$isRenderingPageTemplate = $this->_isRenderingPageTemplate; $this->_isRenderingPageTemplate = true; try { $this->beginPage(); echo $this->renderTemplate($template, $variables); $this->endPage(); } finally { $this->_isRenderingPageTemplate = $isRenderingPageTemplate; $this->setTemplateMode($oldTemplateMode); $output = ob_get_clean(); }
} // Prevent a response formatter from overriding the content-type header $this->response->format = YiiResponse::FORMAT_RAW; // Render and return the template $this->response->data = $view->renderPageTemplate($template, $variables, $templateMode); $headers = $this->response->getHeaders(); if ($generalConfig->sendContentLengthHeader) { $headers->setDefault('content-length', strlen($this->response->data)); }
// Merge any additional route params $routeParams = Craft::$app->getUrlManager()->getRouteParams(); unset($routeParams['template'], $routeParams['template']); $variables = array_merge($variables, $routeParams); return $this->renderTemplate($template, $variables); } /** * Shows the 'offline' template. * * @return Response
$args = $this->controller->bindActionParams($this, $params); Yii::debug('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); if ($oldController !== null) { Yii::$app->controller = $oldController; } return $result; }
* @param string $route * @param array $params * @return Response|null The result of the action, normalized into a Response object */ public function runAction($route, $params = []) { $result = parent::runAction($route, $params); if ($result !== null) { if ($result instanceof Response) { return $result; }
$params = $this->catchAll; unset($params[0]); } try { Yii::debug("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } $response = $this->getResponse(); if ($result !== null) {
if (($response = $this->_processActionRequest($request)) !== null) { return $response; } // If we're still here, finally let Yii do it's thing. try { return parent::handleRequest($request); } catch (\Throwable $e) { $this->_unregisterDebugModule(); throw $e; } }
{ try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
define('CRAFT_ENVIRONMENT', getenv('ENVIRONMENT') ?: 'production'); // ... // Load and run Craft /** @var craft\web\Application $app */ $app = require CRAFT_VENDOR_PATH . '/craftcms/cms/bootstrap/web.php'; $app->run();
$_GET = [ 'p' => 'vakantiehuizen/umbrië', ]; $_COOKIE = [ 'insolita' => 'insol', ];