title: PHP DOMDocument stripping HTML tags
body: <p>I'm working on a small templating engine, and I'm using DOMDocument to parse the pages. My test page so far looks like this:</p>
  
  <pre><code>&lt;block name="content"&gt;
  
     &lt;?php echo 'this is some rendered PHP! &lt;br /&gt;' ?&gt;
  
     &lt;p&gt;Main column of &lt;span&gt;content&lt;/span&gt;&lt;/p&gt;
  
  &lt;/block&gt;
  </code></pre>
  
  <p>And part of my class looks like this:</p>
  
  <pre><code>private function parse($tag, $attr = 'name')
  {
      $strict = 0;
      /*** the array to return ***/
      $out = array();
      if($this-&gt;totalBlocks() &gt; 0)
      {
          /*** a new dom object ***/
          $dom = new domDocument;
          /*** discard white space ***/
          $dom-&gt;preserveWhiteSpace = false;
  
          /*** load the html into the object ***/
          if($strict==1)
          {
              $dom-&gt;loadXML($this-&gt;file_contents);
          }
          else
          {
              $dom-&gt;loadHTML($this-&gt;file_contents);
          }
  
          /*** the tag by its tag name ***/
          $content = $dom-&gt;getElementsByTagname($tag);
  
          $i = 0;
          foreach ($content as $item)
          {
              /*** add node value to the out array ***/
              $out[$i]['name'] = $item-&gt;getAttribute($attr);
              $out[$i]['value'] = $item-&gt;nodeValue;
              $i++;
          }
      }
  
      return $out;
  }
  </code></pre>
  
  <p>I have it working the way I want in that it grabs each &lt;block&gt; on the page and injects it's contents into my template, however, it is stripping the HTML tags within the &lt;block&gt;, thus returning the following without the &lt;p&gt; or &lt;span&gt; tags:</p>
  
  <pre><code>this is some rendered PHP! Main column of content
  </code></pre>
  
  <p>What am I doing wrong here? :) Thanks</p>