Twig\Error\RuntimeError {#2045 -lineno: 11 -name: "errors/404.html.twig" -rawMessage: "Variable "hits" does not exist." -sourcePath: "/var/www/marchebe/wp-content/themes/marchebe/templates/errors/404.html.twig" -sourceCode: """ {% extends "article/base.html.twig" %}\n \n {% block content %}\n <p>Cette page n'existe plus</p>\n <br/>\n <a href="/">\n <p>Retour à la page d'accueil</p>\n </a>\n <br/>\n \n {% if hits|length > 0 %}\n <p><strong>Voici quelques suggestions émises par le moteur de recherche:</strong></p>\n {% include 'search/_results.html.twig' %}\n {% endif %}\n \n {% endblock %}\n \n {% block image %}\n <div class="bg-img w-100 h-220px position-relative h-lg-330px">\n <i style="background-image: url('{{ template_directory }}/assets/images/500.jpg')"\n class="bg-img-news-1 position-absolute top-0 bottom-0 left-0 right-0 md-left-15px md-right-15px lg-left-0 lg-right-0"></i>\n </div>\n {% endblock %}\n \n {% block recommandation %}\n \n {% endblock %}\n """ }
<a href="/">
<p>Retour à la page d'accueil</p>
</a>
<br/>
{% if hits|length > 0 %}
<p><strong>Voici quelques suggestions émises par le moteur de recherche:</strong></p>
{% include 'search/_results.html.twig' %}
{% endif %}
{% endblock %}
</a>
<br/>
";
// line 11
if ((Twig\Extension\CoreExtension::length($this->env->getCharset(), (isset($context["hits"]) || array_key_exists("hits", $context) ? $context["hits"] : (function () { throw new RuntimeError('Variable "hits" does not exist.', 11, $this->source); })())) > 0)) {
// line 12
yield " <p><strong>Voici quelques suggestions émises par le moteur de recherche:</strong></p>
";
// line 13
yield from $this->loadTemplate("search/_results.html.twig", "errors/404.html.twig", 13)->unwrap()->yield($context);
throw new \LogicException('A block must be a method on a \Twig\Template instance.');
}
if (null !== $template) {
try {
yield from $template->$block($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($template->getSourceContext());
}
// line 57
yield " <div id=\"reading\" class=\"m-3\">
<span>
";
// line 59
yield from $this->unwrap()->yieldBlock('content', $context, $blocks);
// line 62
yield " </span>
</div>
</div>
</div>
{
$context += $this->env->getGlobals();
$blocks = array_merge($this->blocks, $blocks);
try {
yield from $this->doDisplay($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($this->getSourceContext());
}
protected function doDisplay(array $context, array $blocks = []): iterable
{
$macros = $this->macros;
$this->parent = $this->loadTemplate("article/base.html.twig", "errors/404.html.twig", 1);
yield from $this->parent->unwrap()->yield($context, array_merge($this->blocks, $blocks));
}
// line 3
/**
* @return iterable<null|scalar|\Stringable>
{
$context += $this->env->getGlobals();
$blocks = array_merge($this->blocks, $blocks);
try {
yield from $this->doDisplay($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($this->getSourceContext());
}
return $this->blocks;
}
public function display(array $context, array $blocks = []): void
{
foreach ($this->yield($context, $blocks) as $data) {
echo $data;
}
}
public function render(array $context): string
ob_start();
} else {
ob_start(function () { return ''; });
}
try {
$this->display($context);
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
yield from $this->template->yieldBlock($name, $context);
}
public function render(array $context = []): string
{
return $this->template->render($context);
}
/**
* @return void
*/
* @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.
*
get_footer();
return;
}
if ($offre == null) {
echo $twig->render(
'errors/404.html.twig',
[
'title' => 'Évènement non trouvé',
'tags' => [],
'color' => Theme::getColorBlog(Theme::TOURISME),
*
* @param string $template The path of the template to include.
*/
$template = apply_filters( 'template_include', $template );
if ( $template ) {
include $template;
} elseif ( current_user_can( 'switch_themes' ) ) {
$theme = wp_get_theme();
if ( $theme->errors() ) {
wp_die( $theme->errors() );
}
// Set up the WordPress query.
wp();
// Load the theme template.
require_once ABSPATH . WPINC . '/template-loader.php';
}
* @var bool
*/
define( 'WP_USE_THEMES', true );
/** Loads the WordPress Environment and Template */
require __DIR__ . '/wp-blog-header.php';
RuntimeError
|
---|
Twig\Error\RuntimeError: Variable "hits" does not exist. at /var/www/marchebe/wp-content/themes/marchebe/templates/errors/404.html.twig:11 at __TwigTemplate_52063507ed5d242800bde18715d57a00->{closure}() (/var/www/marchebe/var/cache/twig/55/5512e329d19fd406b35e573c740ae515.php:69) at __TwigTemplate_52063507ed5d242800bde18715d57a00->block_content() (/var/www/marchebe/vendor/twig/twig/src/Template.php:432) at Twig\Template->yieldBlock() (/var/www/marchebe/var/cache/twig/32/3271827b58cbb9e9afbf5b028054e1d0.php:122) at __TwigTemplate_5885ec7e716b16b6ce16e2689967acc0->doDisplay() (/var/www/marchebe/vendor/twig/twig/src/Template.php:388) at Twig\Template->yield() (/var/www/marchebe/var/cache/twig/55/5512e329d19fd406b35e573c740ae515.php:49) at __TwigTemplate_52063507ed5d242800bde18715d57a00->doDisplay() (/var/www/marchebe/vendor/twig/twig/src/Template.php:388) at Twig\Template->yield() (/var/www/marchebe/vendor/twig/twig/src/Template.php:344) at Twig\Template->display() (/var/www/marchebe/vendor/twig/twig/src/Template.php:359) at Twig\Template->render() (/var/www/marchebe/vendor/twig/twig/src/TemplateWrapper.php:51) at Twig\TemplateWrapper->render() (/var/www/marchebe/vendor/twig/twig/src/Environment.php:334) at Twig\Environment->render() (/var/www/marchebe/wp-content/themes/marchebe/single-event.php:62) at include('/var/www/marchebe/wp-content/themes/marchebe/single-event.php') (/var/www/marchebe/wp-includes/template-loader.php:106) at require_once('/var/www/marchebe/wp-includes/template-loader.php') (/var/www/marchebe/wp-blog-header.php:19) at require('/var/www/marchebe/wp-blog-header.php') (/var/www/marchebe/index.php:17) |