title: Global variables in Laravel Blade template
body: <p>I hope to define global variable in a separate file and then inject in wherever I want, so for Laravel 4 + Blade, I did this.   </p>
  
  <p>Top file    example.blade.php:    </p>
  
  <pre><code>@include('head')    
  @include('body')
  </code></pre>
  
  <p>head.blade.php    </p>
  
  <pre><code>$STYLE_PATH_CSS="styleFolder/foundation/css" 
  $STYLE_PATH_JS="styleFolder/foundation/js" 
  $STYLE_PATH_JS_VENDOR="styleFolder/foundation/js/vendor"
  &lt;link rel="stylesheet" href=" &lt;?php echo $STYLE_PATH_CSS ?&gt;/normalize.css "&gt;
  &lt;link rel="stylesheet" href=" &lt;?php echo $STYLE_PATH_CSS ?&gt;/foundation.css "&gt;
  &lt;link rel="stylesheet" href=" &lt;?php echo $STYLE_PATH_JS_VENDOR ?&gt;/modernizr.js "&gt; 
  </code></pre>
  
  <p>body.blade.php    </p>
  
  <pre><code>&lt;script src="styleFolder/foundation/js/vendor/jquery.js"&gt;&lt;/script&gt;
  &lt;script src="styleFolder/foundation/js/foundation.min.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>Until then, it works fine. Then I hope to simplify one more time: replace the duplicate path by global variable. So,</p>
  
  <p>variables_G.blade.php    </p>
  
  <pre><code>&lt;?php  $STYLE_PATH_CSS="styleFolder/foundation/css" ?&gt;
  &lt;?php  $STYLE_PATH_JS="styleFolder/foundation/js" ?&gt;
  &lt;?php  $STYLE_PATH_JS_VENDOR="styleFolder/foundation/js/vendor" ?&gt;
  </code></pre>
  
  <p>and new head.blade.php</p>
  
  <pre><code>@include('variables_G.blade.php')
  &lt;link rel="stylesheet" href=" &lt;?php echo $STYLE_PATH_CSS ?&gt;/normalize.css "&gt;
  &lt;link rel="stylesheet" href=" &lt;?php echo $STYLE_PATH_CSS ?&gt;/foundation.css "&gt;
  &lt;link rel="stylesheet" href=" &lt;?php echo $STYLE_PATH_JS_VENDOR ?&gt;/modernizr.js "&gt; 
  </code></pre>
  
  <p>then it can't find variables' value. Error message:</p>
  
  <pre><code>Undefined variable: STYLE_PATH_CSS.
  </code></pre>
  
  <p>Can anyone help me out?</p>