title: PHP - echo variable into JavaScript
body: <p>I am trying to put a value within some javascript code like so:</p>
  
  <pre><code>&lt;?
  $page = "test";
  
  echo ('&lt;script id="template-download" type="text/x-jquery-tmpl"&gt;
  &lt;tr class="template-download{{if error}} ui-state-error{{/if}}"&gt;
      {{if error}}
          &lt;td class="name" style="display: none;"&gt;${name}&lt;/td&gt;
          &lt;td class="size" style="display: none;"&gt;${sizef}&lt;/td&gt;
  .....etc...
              {{if thumbnail_url}}
                  &lt;img src="Img/');
                  $page;
                  echo('.jpg"&gt;
              {{/if}}
  .....etc....
  &lt;/script&gt;');
  ?&gt;
  </code></pre>
  
  <p>And the end value looks like this:</p>
  
  <pre><code>            {{if thumbnail_url}}
                  &lt;img src="Img/.jpg"&gt;
              {{/if}}
  </code></pre>
  
  <p>and it doesn't put the value? What am i missing???</p>
  
  <p>David</p>