title: Errors with basic PHP template using eval()
body: <p>I'm just about ready to cry. I have read the php.net manual page, tried a dozen Google searches with various phrases, and scanned hundreds of stackoverflow threads. I have seen this method in use, but it just doesn't work for me. It seems so basic. I have a couple related questions or problems I don't know how to find answers to.</p>
  
  <p>The important part of the PHP file looks like this:</p>
  
  <pre><code>switch() {
  …other cases…
  default:
    $tpl['title'] = "Newsletter Signup";
    $tpl['description'] = "Newsletter description";
    $tpl['page-content'] = file_get_contents('signup.html');
  }
  
  $tpl_src = addslashes(file_get_contents('index.tpl'));
  eval("\$html = \"$tpl_src\";");
  echo $html;
  </code></pre>
  
  <p>My index.tpl file includes lines like these:</p>
  
  <p><code>&lt;title&gt;{$tpl['title']}&lt;/title&gt;<br>
  &lt;meta name="description" content="{$tpl['description']}" /&gt;<br>
  nav, etc…<br>
  &lt;div id="main-content"&gt; {$tpl['page-content']} &lt;/div&gt;</code></p>
  
  <p>I like how neat and clean the code is, without a whole bunch of extra <code>&lt;?=…?&gt;</code>'s.</p>
  
  <p>First, when curly brackets {} appear in a string, what is that called? I might be able to look it up and learn how to use them if I knew.</p>
  
  <p>Next, this just doesn't work at all. If I remove the single quotes from the variable keys, it's good, but php.net says you should never do that in case my name becomes a language constant at some point. Fair enough. But how do I fix this? I like using an array for the vars in case I want to build an evalTemplate subroutine and can just pass $tpl to it.</p>
  
  <p>Lastly, $tpl['page-content'] doesn't print out. The variable is set okay; I can use <code>echo $tpl['page-content']</code> to test, but it appears as a single blank line in the final HTML.</p>
  
  <p>I'm sure there's just some aspect of the language I don't know yet. Any help is much appreciated!!</p>