After some trial and error, I've come to notice that my Template engine fails on template files that contain <script>
tags. This is clearly a huge problem, but I can't seem to figure out why it's failing.
It's very peculiar too, the manner with which it fails. With the <script>
tags commented out, the page loads normally, however with the <script>
tags uncommented, the page loads, and performing a View Source shows that the entire page has loaded, though nothing is rendered in the browser. The Firebug DOM inspector, shows a head tag, and an empty body.
The stranger part (I think at least) is that these script tags are targeting external files. If there was in-page scripting outside of a CDATA section, I could understand some unexpected results.
I'd post the code used, but it's extremely long and I wouldn't know where to start, ie; where the issue is, if in fact there even is one.
In short, my template engine creates a single DOMDocument
object, and then creates DOMDocumentFragment
objects to manage parts of the template. The first parsing iteration typically loads the entire template file into a fragment, and then it works down the tree based on certain parameters, looking for certain tags.
TL;DR: Does anyone know why the PHP DOM classes may be failing to build the page properly due to script tags? If I enclose them in <![CDATA[ ... ]]>
tags, it does nothing. Only when I remove or comment out the tags does a browser load and render the page.