PHP include statement within CDATA tag
I am generating a KML file (which is XML formatted for a Google Map)
Within the infowindow section of the XML file is a CDATA tag.
So when the infowindow is opened on the map, the data within can be formatted with HTML tags.
Here is what I need to do. I need to have a PHP include statement within this cdata section.
I am trying to place the following within the CDATA tag,
<? include("http://www.yahoo.com"); ?>
However what I see when the page loads is:
<![CDATA[<div>
<? include("http://www.yahoo.com"); ?>
</div>开发者_JS百科;
]]>
How can I get this corrected?
Thanks,
If the file has a .kml extension, you'll need to tell your web server to use PHP to serve that file extension. Something like this would do it in Apache:
AddType application/x-httpd-php .kml
If it's a .php file, my suspicion is that PHP's sort tags are disabled, and that you need to use <?php
instead of <?
. There's nothing really special about a CDATA
tag that'd break PHP.
精彩评论