{% else %} {% set news = craft.entries.section('news').limit(100).orderBy('postDate desc').all() %} {% set heading = "All News" %} {% set title = heading %} {% endif %} {% block breadcrumbsContent %} <li class="current">{{filter}}</li> <li>{{filterFormatted}}</li> {% endblock %} {% block contentMain %} {% import '_partials/newsMacros' as newsMacros %} <div class="grid-x grid-padding-x small-up-1 medium-up-1 large-up-2" data-equalizer data-equalize-on="medium">
} // here, $nested means "being at the root level of a child template" // we need to discard the wrapping "Node" for the "body" node $nested = $nested || Node::class !== \get_class($node); foreach ($node as $k => $n) { if (null !== $n && null === $this->filterBodyNodes($n, $nested)) { $node->removeNode($k); } } return $node; }
} // here, $nested means "being at the root level of a child template" // we need to discard the wrapping "Node" for the "body" node $nested = $nested || Node::class !== \get_class($node); foreach ($node as $k => $n) { if (null !== $n && null === $this->filterBodyNodes($n, $nested)) { $node->removeNode($k); } } return $node; }
} // here, $nested means "being at the root level of a child template" // we need to discard the wrapping "Node" for the "body" node $nested = $nested || Node::class !== \get_class($node); foreach ($node as $k => $n) { if (null !== $n && null === $this->filterBodyNodes($n, $nested)) { $node->removeNode($k); } } return $node; }
} // here, $nested means "being at the root level of a child template" // we need to discard the wrapping "Node" for the "body" node $nested = $nested || Node::class !== \get_class($node); foreach ($node as $k => $n) { if (null !== $n && null === $this->filterBodyNodes($n, $nested)) { $node->removeNode($k); } } return $node; }
$this->importedSymbols = [[]]; $this->embeddedTemplates = []; try { $body = $this->subparse($test, $dropNeedle); if (null !== $this->parent && null === $body = $this->filterBodyNodes($body)) { $body = new Node(); } } catch (SyntaxError $e) { if (!$e->getSourceContext()) { $e->setSourceContext($this->stream->getSourceContext()); }
public function parse(TokenStream $stream): ModuleNode { if (null === $this->parser) { $this->parser = new Parser($this); } return $this->parser->parse($stream); } public function setCompiler(Compiler $compiler) { $this->compiler = $compiler; }
* * @throws SyntaxError When there was an error during tokenizing, parsing or compiling */ public function compileSource(Source $source): string { try { return $this->compile($this->parse($this->tokenize($source))); } catch (Error $e) { $e->setSourceContext($source); throw $e; } catch (\Exception $e) { throw new SyntaxError(sprintf('An exception has been thrown during the compilation of a template ("%s").', $e->getMessage()), -1, $source, $e); }
/** * @inheritdoc */ public function compileSource(Source $source): string { Craft::beginProfile($source->getName(), __METHOD__); $result = parent::compileSource($source); Craft::endProfile($source->getName(), __METHOD__); return $result; } /** * @param mixed $strategy The escaper strategy to set. If null, it will be determined based on the template name.
$this->cache->load($key); } $source = null; if (!class_exists($cls, false)) { $source = $this->getLoader()->getSourceContext($name); $content = $this->compileSource($source); $this->cache->write($key, $content); $this->cache->load($key); if (!class_exists($mainCls, false)) { /* Last line of defense if either $this->bcWriteCacheFile was used, * $this->cache is implemented as a no-op or we have a race condition
public function load($name): TemplateWrapper { if ($name instanceof TemplateWrapper) { return $name; } return new TemplateWrapper($this, $this->loadTemplate($this->getTemplateClass($name), $name)); } /** * Loads a template internal representation. * * This method is for internal use only and should never be called
* @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 = []): string { 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(); }
) { $view->registerAssetBundle(ContentWindowAsset::class); } // Render and return the template try { $response->content = $view->renderPageTemplate($behavior->template, $behavior->variables, $behavior->templateMode); } catch (Throwable $e) { $previous = $e->getPrevious(); if ($previous instanceof YiiExitException) { // Something called Craft::$app->end() if ($previous instanceof ExitException && $previous->output !== null) { echo $previous->output;
if (isset($this->formatters[$this->format])) { $formatter = $this->formatters[$this->format]; if (!is_object($formatter)) { $this->formatters[$this->format] = $formatter = Yii::createObject($formatter); } if ($formatter instanceof ResponseFormatterInterface) { $formatter->format($this); } else { throw new InvalidConfigException("The '{$this->format}' response formatter is invalid. It must implement the ResponseFormatterInterface."); } } elseif ($this->format === self::FORMAT_RAW) { if ($this->data !== null) { $this->content = $this->data;
/** * @inheritdoc */ protected function prepare(): void { parent::prepare(); $this->_isPrepared = true; } /** * Clear the output buffer to prevent corrupt downloads. *
public function send() { if ($this->isSent) { return; } $this->trigger(self::EVENT_BEFORE_SEND); $this->prepare(); $this->trigger(self::EVENT_AFTER_PREPARE); $this->sendHeaders(); $this->sendContent(); $this->trigger(self::EVENT_AFTER_SEND); $this->isSent = true; }
$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(); $this->state = self::STATE_END; return $response->exitStatus; } catch (ExitException $e) { $this->end($e->statusCode, isset($response) ? $response : null);
Dotenv\Dotenv::create(CRAFT_BASE_PATH)->load(); } // Load and run Craft define('CRAFT_ENVIRONMENT', getenv('ENVIRONMENT') ?: 'production'); $app = require CRAFT_VENDOR_PATH.'/craftcms/cms/bootstrap/web.php'; $app->run();