Line 139 of class.compiler.php breaks tpl-generated XML files. Reproduction code is:
<foo><bar></bar></foo>
When compiled, an invalid XML file is produced. The error hints at a missing XML declaration.
The line that makes the error is:
$compiled_text = '_version.' '.strftime("%Y-%m-%d %H:%M:%S %Z").' */ ?>'."\n\n"; // stores the compiled result
The cause of the error is the double newline "\n\n". If you correct this to a single newline, e.g.:
$compiled_text = '_version.' '.strftime("%Y-%m-%d %H:%M:%S %Z").' */ ?>'."\n"; // stores the compiled result
The xml files are produced fine. It makes your pretty require_stack line a little uglier, but at least it works.
If you have a better way, I eagerly await the next revision.
--Brian Zab
TemplateLite supporter
Anonymous
Logged In: NO
My original fix didn't work right. It seems that any tags starting with <? are parsed as php tags, including <?xml, which causes errors if such tags are used. On the one hand, writing XML using templates is a bad idea, but on the other hand it shouldn't cause an error. I am working very hard to find a workaround patch as templatelite is a critical piece of my codebase.
As of right now my only fix is to manually edit the compiled template file each time it is updated.
Thanks for your time,
--Brian Zab
TemplateLite supporter