title: Creating my first twig extension to provide global variables to base templates
body: <p>I need to populate a variable with some HTML code and make it available to my base.html.twig file.</p>
  
  <p>To achive this I have made a twig extension. This is my first time using twig extentions so im not sure if this is the correct way of doing things.</p>
  
  <p>Here is what I have so far:</p>
  
  <p><strong>Extension code:</strong> </p>
  
  <pre><code>class GlobalFooterExtension extends \Twig_Extension
  {
  
      public function getFilters()
      {
          return array(
              new \Twig_Filter_Function('GlobalFooter', array($this, 'GlobalFooter')),
          );
      }       
  
      public function GlobalFooter()
      {
  
          $GlobalFooter = file_get_contents('http://mysite.co.uk/footer/footer.html.twig');
  
          return $GlobalFooter;
  
      }
  
  
      public function getName()
      {
          return 'GlobalFooter_extention';
      }
  
  }
  </code></pre>
  
  <p><strong>config.yml:</strong></p>
  
  <pre><code>services:  
  
      imagine.twig.GlobalFooterExtension:
  
          class: Imagine\GdmBundle\Twig\GlobalFooterExtension
          tags:
              - { name: twig.extension } 
  </code></pre>
  
  <p><strong>base.html.twig:</strong></p>
  
  <pre><code>{{GlobalFooter}}
  </code></pre>
  
  <p>This give the following error:</p>
  
  <pre><code>Twig_Error_Runtime: Variable "GlobalFooter" does not exist in "ImagineGdmBundle:Default:product.html.twig" at line 2
  </code></pre>
  
  <p>Im sure im missing something really obvious. How do I make $GlobalFooter from my GlobalFooterExtension class available to my base.hmtl.twig file?</p>