Variable "headline" does not exist. (500 Whoops, looks like something went wrong.)

Variable "headline" does not exist.

Exception

Twig\Error\ RuntimeError

Show exception properties
Twig\Error\RuntimeError {#1071
  -lineno: 6
  -name: "@components/3-organisms/search-block/search-block.twig"
  -rawMessage: "Variable "headline" does not exist."
  -sourcePath: "/Users/dennis/Projekte/e-fellows/src/components/3-organisms/search-block/search-block.twig"
  -sourceCode: """
    {% do craft.app.view.registerJsFile('https://scripts.chatbar-ai.com/cb-ai-search.min.js', {\n
        position: 1\n
    }) %}\n
    \n
    <div class="search-block">\n
        {% if headline %}\n
            <div class="search-block__headline headline headline--2">\n
                <h2>{{ headline }}</h2>\n
            </div>\n
        {% endif %}\n
        <div class="search-block__inner">\n
            <div class="search-container">\n
                <div id="ai-search-results">\n
                </div>\n
                <div class="item center" id="chatBot">\n
                    <div id="auto_ai_search_bot">\n
                        <p class="filler">\n
                            {{ 'AI-search is loading...' | t }}\n
                        </p>\n
                    </div>\n
                </div>\n
            </div>\n
        </div>\n
    </div>\n
    \n
    {% js at head  %}\n
        var searchResultsEle;\n
        var searchContainer;\n
        function addPageBox(sr) {\n
            var descHTML = "";\n
            var limit = window.innerWidth > 768 ? 100 : 50;\n
            if (sr.description) {\n
                let description = sr.description;\n
                if (description.length > limit) {\n
                    description = description.substring(0, limit) + ' ...';\n
                }\n
                descHTML = '<p class="desc">' + description.replace('target="_blank"', '') + '</p>';\n
            }\n
            var div = document.createElement('div');\n
            div.classList.add('result-wrapper');\n
            var title = sr.title && sr.title.trim() !== '' ? sr.title : '';\n
            if (title) {\n
              title = title.replace(' - e-fellows.netAutor*innen', '').replace(' - e-fellows.net', '');\n
            }\n
            div.innerHTML = '<a class="link-box" href="'+ sr.source +'"><p class="title">' + title + '</p>' + descHTML + '</a>';\n
            searchResultsEle.appendChild(div);\n
        }\n
        searchResultsCallback = function(search_results) {\n
            searchResultsEle.innerHTML = '';\n
            search_results.forEach(function(sr) {\n
                addPageBox(sr);\n
            });\n
        };\n
        document.addEventListener('DOMContentLoaded', async function() {\n
            searchContainer = document.getElementById('auto_ai_search_bot');\n
            searchResultsEle = document.getElementById('ai-search-results');\n
            _bl_ai_search.init('{{ getenv("BUSINESS_LANDING_TOKEN") }}', searchContainer, {\n
                searchResultsCallback: searchResultsCallback,\n
            });\n
        });\n
    {% endjs %}
    """
}
  1. {% do craft.app.view.registerJsFile('https://scripts.chatbar-ai.com/cb-ai-search.min.js', {
  2. position: 1
  3. }) %}
  4. <div class="search-block">
  5. {% if headline %}
  6. <div class="search-block__headline headline headline--2">
  7. <h2>{{ headline }}</h2>
  8. </div>
  9. {% endif %}
  10. <div class="search-block__inner">
__TwigTemplate_4978ddf1bbcdfb89410907d15e3b68a1->{closure:__TwigTemplate_4978ddf1bbcdfb89410907d15e3b68a1::doDisplay():50}() in /Users/dennis/Projekte/e-fellows/storage/runtime/compiled_templates/f4/f44f1da644e725d530718350b465947a.php (line 50)
  1. // line 4
  2. yield "
  3. <div class=\"search-block\">
  4. ";
  5. // line 6
  6. if ((isset($context["headline"]) || array_key_exists("headline", $context) ? $context["headline"] : (craft\helpers\Template::fallbackExists("headline") ? craft\helpers\Template::fallback("headline") : (function () { throw new RuntimeError('Variable "headline" does not exist.', 6, $this->source); })()))) {
  7. // line 7
  8. yield " <div class=\"search-block__headline headline headline--2\">
  9. <h2>";
  10. // line 8
  11. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape((isset($context["headline"]) || array_key_exists("headline", $context) ? $context["headline"] : (craft\helpers\Template::fallbackExists("headline") ? craft\helpers\Template::fallback("headline") : (function () { throw new RuntimeError('Variable "headline" does not exist.', 8, $this->source); })())), "html", null, true);
  1. {
  2. $context += $this->env->getGlobals();
  3. $blocks = array_merge($this->blocks, $blocks);
  4. try {
  5. yield from $this->doDisplay($context, $blocks);
  6. } catch (Error $e) {
  7. if (!$e->getSourceContext()) {
  8. $e->setSourceContext($this->getSourceContext());
  9. }
  1. return $this->blocks;
  2. }
  3. public function display(array $context, array $blocks = []): void
  4. {
  5. foreach ($this->yield($context, $blocks) as $data) {
  6. echo $data;
  7. }
  8. }
  9. public function render(array $context): string
  1. ob_start();
  2. } else {
  3. ob_start(function () { return ''; });
  4. }
  5. try {
  6. $this->display($context);
  7. } catch (\Throwable $e) {
  8. while (ob_get_level() > $level) {
  9. ob_end_clean();
  10. }
  1. ) {
  2. }
  3. public function render(array $context = []): string
  4. {
  5. return $this->template->render($context);
  6. }
  7. public function display(array $context = [])
  8. {
  9. // using func_get_args() allows to not expose the blocks argument
  1. * @throws SyntaxError When an error occurred during compilation
  2. * @throws RuntimeError When an error occurred during rendering
  3. */
  4. public function render($name, array $context = []): string
  5. {
  6. return $this->load($name)->render($context);
  7. }
  8. /**
  9. * Displays a template.
  10. *
  1. // Render and return
  2. $renderingTemplate = $this->_renderingTemplate;
  3. $this->_renderingTemplate = $template;
  4. try {
  5. $output = $this->getTwig()->render($template, $variables);
  6. } finally {
  7. $this->_renderingTemplate = $renderingTemplate;
  8. $this->setTemplateMode($oldTemplateMode);
  9. }
  1. $isRenderingPageTemplate = $this->_isRenderingPageTemplate;
  2. $this->_isRenderingPageTemplate = true;
  3. try {
  4. $this->beginPage();
  5. echo $this->renderTemplate($template, $variables);
  6. $this->endPage();
  7. } finally {
  8. $this->_isRenderingPageTemplate = $isRenderingPageTemplate;
  9. $this->setTemplateMode($oldTemplateMode);
  10. $output = ob_get_clean();
View->renderPageTemplate('@components/3-organisms/search-block/search-block.twig', array('title' => 'KI-gestützte Suche'), 'site') in /Users/dennis/Projekte/e-fellows/src/module/Console/Controller/ComponentController.php (line 56)
  1. $event->roots['@components'] = Craft::getAlias('@root/src/components');
  2. },
  3. );
  4. // Return rendered component
  5. Console::stdout(Craft::$app->getView()->renderPageTemplate(
  6. "@components/{$template}",
  7. $context,
  8. View::TEMPLATE_MODE_SITE,
  9. ));
  10. } catch (\Throwable $exception) {
ComponentController->actionRender('3-organisms/search-block/search-block.twig')
  1. Yii::debug('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__);
  2. if (Yii::$app->requestedParams === null) {
  3. Yii::$app->requestedParams = $args;
  4. }
  5. return call_user_func_array([$this->controller, $this->actionMethod], $args);
  6. }
  7. }
  1. $result = null;
  2. if ($runAction && $this->beforeAction($action)) {
  3. // run the action
  4. $result = $action->runWithParams($params);
  5. $result = $this->afterAction($action, $result);
  6. // call afterAction on modules
  7. foreach ($modules as $module) {
  1. if ($this->help) {
  2. $route = $this->getUniqueId() . '/' . $id;
  3. return Yii::$app->runAction('help', [$route]);
  4. }
  5. return parent::runAction($id, $params);
  6. }
  7. /**
  8. * Binds the parameters to the action.
  9. * This method is invoked by [[Action]] when it begins to run with the given parameters.
  1. public function runAction($id, $params = [])
  2. {
  3. try {
  4. // *should* only be an int, but there are exceptions :/
  5. /** @var int|null $response */
  6. $response = parent::runAction($id, $params);
  7. return $response ?? ExitCode::OK;
  8. } finally {
  9. if (isset($this->isolationMutexName)) {
  10. Craft::$app->getMutex()->release($this->isolationMutexName);
  11. }
  1. * @inheritdoc
  2. */
  3. public function runAction($id, $params = []): int
  4. {
  5. $this->_actionId = $id;
  6. $result = $this->traitRunAction($id, $params);
  7. $this->_actionId = null;
  8. return $result;
  9. }
  10. /**
  1. if (is_array($parts)) {
  2. /* @var $controller Controller */
  3. list($controller, $actionID) = $parts;
  4. $oldController = Yii::$app->controller;
  5. Yii::$app->controller = $controller;
  6. $result = $controller->runAction($actionID, $params);
  7. if ($oldController !== null) {
  8. Yii::$app->controller = $oldController;
  9. }
  10. return $result;
  1. * @throws Exception if the route is invalid
  2. */
  3. public function runAction($route, $params = [])
  4. {
  5. try {
  6. $res = parent::runAction($route, $params);
  7. return is_object($res) ? $res : (int) $res;
  8. } catch (InvalidRouteException $e) {
  9. throw new UnknownCommandException($route, $this, 0, $e);
  10. }
  11. }
  1. }
  2. Console::outputWarning("Craft can’t fetch the `$infoTable` table row." . ($e ? PHP_EOL . 'Exception: ' . $e->getMessage() : ''), false);
  3. }
  4. }
  5. return parent::runAction($route, $params);
  6. }
  7. /**
  8. * @inheritdoc
  9. */
  1. */
  2. public function handleRequest($request)
  3. {
  4. list($route, $params) = $request->resolve();
  5. $this->requestedRoute = $route;
  6. $result = $this->runAction($route, $params);
  7. if ($result instanceof Response) {
  8. return $result;
  9. }
  10. $response = $this->getResponse();
  1. public function handleRequest($request)
  2. {
  3. // Disable read/write splitting for all console requests
  4. $this->getDb()->enableReplicas = false;
  5. return parent::handleRequest($request);
  6. }
  7. /**
  8. * Returns the configuration of the built-in commands.
  9. *
  1. try {
  2. $this->state = self::STATE_BEFORE_REQUEST;
  3. $this->trigger(self::EVENT_BEFORE_REQUEST);
  4. $this->state = self::STATE_HANDLING_REQUEST;
  5. $response = $this->handleRequest($this->getRequest());
  6. $this->state = self::STATE_AFTER_REQUEST;
  7. $this->trigger(self::EVENT_AFTER_REQUEST);
  8. $this->state = self::STATE_SENDING_RESPONSE;
Application->run() in /Users/dennis/Projekte/e-fellows/craft (line 17)
  1. // Load and run Craft
  2. /** @var craft\console\Application $app */
  3. // nosemgrep: file-inclusion
  4. $app = require CRAFT_VENDOR_PATH . '/craftcms/cms/bootstrap/console.php';
  5. $exitCode = $app->run();
  6. exit($exitCode);

Stack Trace

RuntimeError
Twig\Error\RuntimeError:
Variable "headline" does not exist.

  at /Users/dennis/Projekte/e-fellows/src/components/3-organisms/search-block/search-block.twig:6
  at __TwigTemplate_4978ddf1bbcdfb89410907d15e3b68a1->{closure:__TwigTemplate_4978ddf1bbcdfb89410907d15e3b68a1::doDisplay():50}()
     (/Users/dennis/Projekte/e-fellows/storage/runtime/compiled_templates/f4/f44f1da644e725d530718350b465947a.php:50)
  at __TwigTemplate_4978ddf1bbcdfb89410907d15e3b68a1->doDisplay(array('title' => 'KI-gestützte Suche', 'craft' => object(CraftVariable), 'currentSite' => object(Site), 'currentUser' => null, 'primarySite' => object(Site), 'siteName' => 'Für Studierende und Berufstätige', 'siteUrl' => '@web/', 'systemName' => 'e-fellows.net', 'view' => object(View), 'devMode' => true, 'SORT_ASC' => 4, 'SORT_DESC' => 3, 'SORT_REGULAR' => 0, 'SORT_NUMERIC' => 1, 'SORT_STRING' => 2, 'SORT_LOCALE_STRING' => 5, 'SORT_NATURAL' => 6, 'SORT_FLAG_CASE' => 8, 'PHP_INT_MAX' => 9223372036854775807, 'POS_HEAD' => 1, 'POS_BEGIN' => 2, 'POS_END' => 3, 'POS_READY' => 4, 'POS_LOAD' => 5, 'isInstalled' => true, 'loginUrl' => '@web/', 'logoutUrl' => '@web/', 'setPasswordUrl' => null, 'now' => object(DateTime), 'today' => object(DateTime), 'tomorrow' => object(DateTime), 'yesterday' => object(DateTime), '_globals' => object(Collection), 'currentSsoUser' => null, 'login' => object(Entry), 'loginOtc' => object(Entry), 'forgotPassword' => object(Entry)), array())
     (/Users/dennis/Projekte/e-fellows/vendor/twig/twig/src/Template.php:387)
  at Twig\Template->yield(array('title' => 'KI-gestützte Suche', 'craft' => object(CraftVariable), 'currentSite' => object(Site), 'currentUser' => null, 'primarySite' => object(Site), 'siteName' => 'Für Studierende und Berufstätige', 'siteUrl' => '@web/', 'systemName' => 'e-fellows.net', 'view' => object(View), 'devMode' => true, 'SORT_ASC' => 4, 'SORT_DESC' => 3, 'SORT_REGULAR' => 0, 'SORT_NUMERIC' => 1, 'SORT_STRING' => 2, 'SORT_LOCALE_STRING' => 5, 'SORT_NATURAL' => 6, 'SORT_FLAG_CASE' => 8, 'PHP_INT_MAX' => 9223372036854775807, 'POS_HEAD' => 1, 'POS_BEGIN' => 2, 'POS_END' => 3, 'POS_READY' => 4, 'POS_LOAD' => 5, 'isInstalled' => true, 'loginUrl' => '@web/', 'logoutUrl' => '@web/', 'setPasswordUrl' => null, 'now' => object(DateTime), 'today' => object(DateTime), 'tomorrow' => object(DateTime), 'yesterday' => object(DateTime), '_globals' => object(Collection), 'currentSsoUser' => null, 'login' => object(Entry), 'loginOtc' => object(Entry), 'forgotPassword' => object(Entry)), array())
     (/Users/dennis/Projekte/e-fellows/vendor/twig/twig/src/Template.php:343)
  at Twig\Template->display(array('title' => 'KI-gestützte Suche'))
     (/Users/dennis/Projekte/e-fellows/vendor/twig/twig/src/Template.php:358)
  at Twig\Template->render(array('title' => 'KI-gestützte Suche'))
     (/Users/dennis/Projekte/e-fellows/vendor/twig/twig/src/TemplateWrapper.php:35)
  at Twig\TemplateWrapper->render(array('title' => 'KI-gestützte Suche'))
     (/Users/dennis/Projekte/e-fellows/vendor/twig/twig/src/Environment.php:320)
  at Twig\Environment->render('@components/3-organisms/search-block/search-block.twig', array('title' => 'KI-gestützte Suche'))
     (/Users/dennis/Projekte/e-fellows/vendor/craftcms/cms/src/web/View.php:570)
  at craft\web\View->renderTemplate('@components/3-organisms/search-block/search-block.twig', array('title' => 'KI-gestützte Suche'))
     (/Users/dennis/Projekte/e-fellows/vendor/craftcms/cms/src/web/View.php:623)
  at craft\web\View->renderPageTemplate('@components/3-organisms/search-block/search-block.twig', array('title' => 'KI-gestützte Suche'), 'site')
     (/Users/dennis/Projekte/e-fellows/src/module/Console/Controller/ComponentController.php:56)
  at EFellows\Website\Console\Controller\ComponentController->actionRender('3-organisms/search-block/search-block.twig')
  at call_user_func_array(array(object(ComponentController), 'actionRender'), array('3-organisms/search-block/search-block.twig'))
     (/Users/dennis/Projekte/e-fellows/vendor/yiisoft/yii2/base/InlineAction.php:57)
  at yii\base\InlineAction->runWithParams(array('3-organisms/search-block/search-block.twig'))
     (/Users/dennis/Projekte/e-fellows/vendor/yiisoft/yii2/base/Controller.php:178)
  at yii\base\Controller->runAction('render', array('3-organisms/search-block/search-block.twig'))
     (/Users/dennis/Projekte/e-fellows/vendor/yiisoft/yii2/console/Controller.php:180)
  at yii\console\Controller->runAction('render', array('3-organisms/search-block/search-block.twig'))
     (/Users/dennis/Projekte/e-fellows/vendor/craftcms/cms/src/console/ControllerTrait.php:88)
  at craft\console\Controller->traitRunAction('render', array('3-organisms/search-block/search-block.twig'))
     (/Users/dennis/Projekte/e-fellows/vendor/craftcms/cms/src/console/Controller.php:216)
  at craft\console\Controller->runAction('render', array('3-organisms/search-block/search-block.twig'))
     (/Users/dennis/Projekte/e-fellows/vendor/yiisoft/yii2/base/Module.php:552)
  at yii\base\Module->runAction('efellows/component/render', array('3-organisms/search-block/search-block.twig'))
     (/Users/dennis/Projekte/e-fellows/vendor/yiisoft/yii2/console/Application.php:180)
  at yii\console\Application->runAction('efellows/component/render', array('3-organisms/search-block/search-block.twig'))
     (/Users/dennis/Projekte/e-fellows/vendor/craftcms/cms/src/console/Application.php:91)
  at craft\console\Application->runAction('efellows/component/render', array('3-organisms/search-block/search-block.twig'))
     (/Users/dennis/Projekte/e-fellows/vendor/yiisoft/yii2/console/Application.php:147)
  at yii\console\Application->handleRequest(object(Request))
     (/Users/dennis/Projekte/e-fellows/vendor/craftcms/cms/src/console/Application.php:122)
  at craft\console\Application->handleRequest(object(Request))
     (/Users/dennis/Projekte/e-fellows/vendor/yiisoft/yii2/base/Application.php:384)
  at yii\base\Application->run()
     (/Users/dennis/Projekte/e-fellows/craft:17)