tags:

views:

302

answers:

2

I am having a really frustrating problem in CakePHP where a space keeps coming up at the beginning of my KML file layout which causes Google Earth to reject the KML file!

<?php header("Content-disposition: attachment; filename=area.kml");
header("Content-Type: application/vnd.google-earth.kml+xml kml; charset=utf8");
header("Content-Transfer-Encoding: binary");
header("Pragma: no-cache");
header("Expires: 0");
echo '<?xml version="1.0" encoding="UTF-8"?>';
 ?>
<kml xmlns="http://earth.google.com/kml/2.2"&gt;
    <Document>
     <?php echo $content_for_layout ?>
    </Document>
</kml>

for the output I get

" <?xml version="1.0" encoding="UTF-8"?>"

ect ect please help!

+1  A: 

This can happen if you're including a php file that has a space after the closing ?>. For this reason, it is generally recommended that you don't include that tag (except, e.g., in a view, where you're echoing a variable and other content follows).

notJim
thanks I had a space in my app_controller
Russell
+1  A: 

It's the c/r after the ?> tag and before the <kml tag. Put them together and it should be better. Like this...

?><kml

Dan Berlyoung