开发者

PHP include statement within CDATA tag

开发者 https://www.devze.com 2023-04-11 16:22 出处:网络
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.

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> &lt;? include(&quot;http://www.yahoo.com&quot;); ?&gt; &nbsp;</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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号