title: Twig concatenate and function
body: <p>I've written a special function for TWIG that manages the languages URL's.</p>
  
  <pre><code>$URLWithLang = new Twig_SimpleFilter('url', function($URL)
  {
      if(substr($URL, -1) == '/'){
          $URL = "/".$_GET['lang']."/".$URL;
      }
      else{
          $URL = "/".$_GET['lang']."/".$URL."/";      
      }
      return $URL;
  });
  </code></pre>
  
  <p>The functions works perfect with URL's like: <code>{{'about-us'|url}}</code> => en/about-us/</p>
  
  <p>However, when using a variable and text, like below. It put the language for some reason in between. </p>
  
  <p><code>{{'/bl'~ car.carURL|url}}</code> => /bl/en/252-fiat-panda/ </p>
  
  <p>How should i change the statement in order to make it output. /en/bl/252-fiat-panda? </p>
  
  <p>Thanks in advance!</p>