<div class="related-articles w-full hidden lg:w-5/12 xl:w-4/12 lg:block" data-aos="fade-up" data-aos-duration="800" data-aos-delay="300"> <div class="inner pt-16 float-left"> {% if block.heading|length > 0 %} <h4>{{ block.heading }}</h4> {% endif %} {% for itemData in block.relatedContent.all() %} <article class="article bg-white page-item-shadow mb-0"> {% set newsItem = itemData.relatedItem.one() %} {% set image = newsItem.articleImage.one() %} {% set transformedImages = craft.imager.transformImage(image, [ { width: 188, height: 180, jpegQuality: 75 }, ],{ format: 'jpg', allowUpscale: false, mode: 'crop', interlace: true }) %} <img class="thumb float-left" src="{{ transformedImages[0].url }}" sizes="100vw" srcset="{{ craft.imager.srcset(transformedImages) }}" alt="{{ newsItem.title }}"> {#<img class="thumb float-left" src="{{ alias('@web/assets/images/article-square.jpg') }}" alt="" />#} <div class="article-details float-left"> <span class="title font-medium leading-tight block mb-2 text-sm text-left">{{ newsItem.shortTitle }}</span>
if (is_object($value) && get_class($value) === Markup::class) { $arguments[$key] = (string)$value; } } try { return twig_get_attribute($env, $source, $object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck); } catch (UnknownMethodException $e) { // Copy twig_get_attribute()'s BadMethodCallException handling if ($ignoreStrictCheck || !$env->isStrictVariables()) { return null; } throw new RuntimeError($e->getMessage(), -1, $source);
<h4>{{ block.heading }}</h4> {% endif %} {% for itemData in block.relatedContent.all() %} <article class="article bg-white page-item-shadow mb-0"> {% set newsItem = itemData.relatedItem.one() %} {% set image = newsItem.articleImage.one() %} {% set transformedImages = craft.imager.transformImage(image, [ { width: 188, height: 180, jpegQuality: 75 }, ],{ format: 'jpg', allowUpscale: false, mode: 'crop', interlace: true }) %} <img class="thumb float-left" src="{{ transformedImages[0].url }}" sizes="100vw" srcset="{{ craft.imager.srcset(transformedImages) }}" alt="{{ newsItem.title }}">
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()) {
} public function display(array $context = []) { // using func_get_args() allows to not expose the blocks argument // as it should only be used by internal code $this->template->display($context, \func_get_args()[1] ?? []); } public function hasBlock(string $name, array $context = []): bool { return $this->template->hasBlock($name, $context); }
{% if entry.headerBuilder and entry.headerBuilder.count() > 0 %} {% for block in entry.headerBuilder.all() %} {% include ['./default/_partials/_block_' ~ block.type.handle] ignore missing %} {% endfor %} {% endif %}
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()) {
{% set bodyClass = 'news-article' %} {% block main %} {% include "./_partials/_block_breadcrumb" with {'entryTitle': entry.title } %} {% include "./_includes/article_header" %} <section class="page-content"> {% include "./_includes/article_body" %} </section> {% endblock %}
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> </nav> </section> </header> <main role="main" class="relative"> {% block main %} ... {% endblock %} </main> <section class="pre-footer section"> <div class="container"> <div class="row">
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()) {
{# /index.twig #} {% extends "_layouts/_base" %} {#{% import "macro/srcsetImage" as srcsetImage %}#} {% set bodyClass = 'news-article' %} {% block main %}
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;
$this->env = $env; $this->template = $template; } public function render(array $context = []): string { return $this->template->render($context); } public function display(array $context = []) { // using func_get_args() allows to not expose the blocks argument // as it should only be used by internal code
* @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);
// Load shared bootstrap require dirname(__DIR__) . '/bootstrap.php'; // Load and run Craft define('CRAFT_ENVIRONMENT', getenv('ENVIRONMENT') ?: 'production'); $app = require CRAFT_VENDOR_PATH.'/craftcms/cms/bootstrap/web.php'; $app->run();