Answers.Body: <p><code>siteName</code> is automatically global... you don't need to include the <code>global.</code> prefix.</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;title&gt;{{ siteName }}&lt;/title&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-02T07:24:31.860Z
Answers.LastActivityDate: 2016-08-02T07:24:31.860Z
Answers.UserDisplayName: Lindsey D
Body: <p>I am trying to set up a Craft CMS website with Twig. I have done all the setup but getting the following error when I try to open the website- </p>
  
  
  
  <pre class="lang-html prettyprint-override"><code>Twig_Error_Runtime
  
  Variable "global" does not exist in "503" at line 9 (C:\wamp64\www\west\craft\app\vendor\twig\twig\lib\Twig\Template.php:436)
  
  #0 C:\wamp64\www\west\craft\storage\runtime\compiled_templates\00\0009102817a5d89769207212bd179d422974c0400e0d4db894ad4fd45f35fd9d.php(29): Twig_Template-&gt;getContext(Array, 'global')
  #1 C:\wamp64\www\west\craft\app\vendor\twig\twig\lib\Twig\Template.php(381): __TwigTemplate_37e5d62204d15e3586ae79a226d2d0e58f18084c697fef1d38e94cf3b75f8fb0-&gt;doDisplay(Array, Array)
  #2 C:\wamp64\www\west\craft\app\etc\templating\BaseTemplate.php(26): Twig_Template-&gt;displayWithErrorHandling(Array, Array)
  #3 C:\wamp64\www\west\craft\app\vendor\twig\twig\lib\Twig\Template.php(355): Craft\BaseTemplate-&gt;displayWithErrorHandling(Array, Array)
  #4 C:\wamp64\www\west\craft\app\vendor\twig\twig\lib\Twig\Template.php(366): Twig_Template-&gt;display(Array)
  #5 C:\wamp64\www\west\craft\app\vendor\twig\twig\lib\Twig\Environment.php(347): Twig_Template-&gt;render(Array)
  #6 C:\wamp64\www\west\craft\app\services\TemplatesService.php(248): Twig_Environment-&gt;render('503', Array)
  #7 C:\wamp64\www\west\craft\app\controllers\BaseController.php(74): Craft\TemplatesService-&gt;render('503', Array)
  #8 C:\wamp64\www\west\craft\app\controllers\TemplatesController.php(200): Craft\BaseController-&gt;renderTemplate('503', Array)
  #9 C:\wamp64\www\west\craft\app\framework\web\actions\CInlineAction.php(49): Craft\TemplatesController-&gt;actionRenderError()
  #10 C:\wamp64\www\west\craft\app\framework\web\CController.php(308): CInlineAction-&gt;runWithParams(Array)
  #11 C:\wamp64\www\west\craft\app\framework\web\CController.php(286): CController-&gt;runAction(Object(CInlineAction))
  #12 C:\wamp64\www\west\craft\app\framework\web\CController.php(265): CController-&gt;runActionWithFilters(Object(CInlineAction), Array)
  #13 C:\wamp64\www\west\craft\app\framework\web\CWebApplication.php(282): CController-&gt;run('renderError')
  #14 C:\wamp64\www\west\craft\app\framework\base\CErrorHandler.php(368): CWebApplication-&gt;runController('templates/rende...')
  #15 C:\wamp64\www\west\craft\app\etc\errors\ErrorHandler.php(281): CErrorHandler-&gt;renderError()
  #16 C:\wamp64\www\west\craft\app\framework\base\CErrorHandler.php(351): Craft\ErrorHandler-&gt;renderError()
  #17 C:\wamp64\www\west\craft\app\framework\base\CErrorHandler.php(218): CErrorHandler-&gt;renderException()
  #18 C:\wamp64\www\west\craft\app\etc\errors\ErrorHandler.php(145): CErrorHandler-&gt;handleException(Object(Craft\HttpException))
  #19 C:\wamp64\www\west\craft\app\framework\base\CErrorHandler.php(131): Craft\ErrorHandler-&gt;handleException(Object(Craft\HttpException))
  #20 C:\wamp64\www\west\craft\app\framework\base\CApplication.php(750): CErrorHandler-&gt;handle(Object(CExceptionEvent))
  #21 [internal function]: CApplication-&gt;handleException(Object(Craft\HttpException))
  #22 {main}
  </code></pre>
  
  
  
  <p>Here's the code from where the exception is thrown-</p>
  
  <pre><code>&lt;title&gt;        
      echo twig_escape_filter($this-&gt;env, $this-&gt;getAttribute((isset($context["global"]) ? $context["global"] : $this-&gt;getContext($context, "global")), "siteName", array()), "html", null, true);
      &lt;/title&gt;
  </code></pre>
  
  <p>Template 503 - </p>
  
  
  
  <pre class="lang-html prettyprint-override"><code>&lt;!doctype html&gt;
  &lt;html class="no-js" lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"&gt;
      &lt;meta name="robots" content="noindex"&gt;
  
      &lt;title&gt;{{ global.siteName }}&lt;/title&gt;
  &lt;/head&gt;
  &lt;body style="height: 100%; margin: 0;"&gt;
  
      &lt;h1 style="text-align:center; margin: 100px 0 100px;"&gt;{{ global.siteName }}&lt;/h1&gt;
  
  &lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-02T07:16:35.957Z
Comments.Text: Does this have anything to do with database connection? Eve if I delete the database, it's showing the same error.
Comments.UserDisplayName: Amey Dahale
Tags: <templating><php>
Title: Getting Twig_Error_Runtime when trying to open the website
ThreadText: # Getting Twig_Error_Runtime when trying to open the website
  
  (Asked by: username_0 on 2016-08-02)
  
  I am trying to set up a Craft CMS website with Twig. I have done all the setup but getting the following error when I try to open the website-
  
  ```html
  Twig_Error_Runtime
  
  Variable "global" does not exist in "503" at line 9 (C:\wamp64\www\west\craft\app\vendor\twig\twig\lib\Twig\Template.php:436)
  
  #0 C:\wamp64\www\west\craft\storage\runtime\compiled_templates\00\0009102817a5d89769207212bd179d422974c0400e0d4db894ad4fd45f35fd9d.php(29): Twig_Template->getContext(Array, 'global')
  #1 C:\wamp64\www\west\craft\app\vendor\twig\twig\lib\Twig\Template.php(381): __TwigTemplate_37e5d62204d15e3586ae79a226d2d0e58f18084c697fef1d38e94cf3b75f8fb0->doDisplay(Array, Array)
  #2 C:\wamp64\www\west\craft\app\etc\templating\BaseTemplate.php(26): Twig_Template->displayWithErrorHandling(Array, Array)
  #3 C:\wamp64\www\west\craft\app\vendor\twig\twig\lib\Twig\Template.php(355): Craft\BaseTemplate->displayWithErrorHandling(Array, Array)
  #4 C:\wamp64\www\west\craft\app\vendor\twig\twig\lib\Twig\Template.php(366): Twig_Template->display(Array)
  #5 C:\wamp64\www\west\craft\app\vendor\twig\twig\lib\Twig\Environment.php(347): Twig_Template->render(Array)
  #6 C:\wamp64\www\west\craft\app\services\TemplatesService.php(248): Twig_Environment->render('503', Array)
  #7 C:\wamp64\www\west\craft\app\controllers\BaseController.php(74): Craft\TemplatesService->render('503', Array)
  #8 C:\wamp64\www\west\craft\app\controllers\TemplatesController.php(200): Craft\BaseController->renderTemplate('503', Array)
  #9 C:\wamp64\www\west\craft\app\framework\web\actions\CInlineAction.php(49): Craft\TemplatesController->actionRenderError()
  #10 C:\wamp64\www\west\craft\app\framework\web\CController.php(308): CInlineAction->runWithParams(Array)
  #11 C:\wamp64\www\west\craft\app\framework\web\CController.php(286): CController->runAction(Object(CInlineAction))
  #12 C:\wamp64\www\west\craft\app\framework\web\CController.php(265): CController->runActionWithFilters(Object(CInlineAction), Array)
  #13 C:\wamp64\www\west\craft\app\framework\web\CWebApplication.php(282): CController->run('renderError')
  #14 C:\wamp64\www\west\craft\app\framework\base\CErrorHandler.php(368): CWebApplication->runController('templates/rende...')
  #15 C:\wamp64\www\west\craft\app\etc\errors\ErrorHandler.php(281): CErrorHandler->renderError()
  #16 C:\wamp64\www\west\craft\app\framework\base\CErrorHandler.php(351): Craft\ErrorHandler->renderError()
  #17 C:\wamp64\www\west\craft\app\framework\base\CErrorHandler.php(218): CErrorHandler->renderException()
  #18 C:\wamp64\www\west\craft\app\etc\errors\ErrorHandler.php(145): CErrorHandler->handleException(Object(Craft\HttpException))
  #19 C:\wamp64\www\west\craft\app\framework\base\CErrorHandler.php(131): Craft\ErrorHandler->handleException(Object(Craft\HttpException))
  #20 C:\wamp64\www\west\craft\app\framework\base\CApplication.php(750): CErrorHandler->handle(Object(CExceptionEvent))
  #21 [internal function]: CApplication->handleException(Object(Craft\HttpException))
  #22 {main}
  
  ```
  
  Here's the code from where the exception is thrown-
  
  ```
  <title>        
      echo twig_escape_filter($this->env, $this->getAttribute((isset($context["global"]) ? $context["global"] : $this->getContext($context, "global")), "siteName", array()), "html", null, true);
      </title>
  
  ```
  
  Template 503 -
  
  ```html
  <!doctype html>
  <html class="no-js" lang="en">
  <head>
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
      <meta name="robots" content="noindex">
  
      <title>{{ global.siteName }}</title>
  </head>
  <body style="height: 100%; margin: 0;">
  
      <h1 style="text-align:center; margin: 100px 0 100px;">{{ global.siteName }}</h1>
  
  </body></html>
  
  ```
  
  **Tags:** templating, php
  
  > **Comments:**
  > **username_0**: Does this have anything to do with database connection? Eve if I delete the database, it's showing the same error.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-08-02. Score: 5
  
  `siteName` is automatically global... you don't need to include the `global.` prefix.
  
  ```html
  <title>{{ siteName }}</title>
  
  ```
  
  
  ---
  
  