创建geoRss feed

问题描述

| 我是geoRSS的新手。 我们如何编写geoRSS提要。我有我想添加到geoRSS Feed中的lat long值和MysqL db中的其他一些字段。 谢谢并恭祝安康, 阿什什     

解决方法

尝试使用此代码输出geoRSS
header(\"Content-type: text/xml\");
    $xml_output = \"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\"?>\\n\";
    $xml_output .= \"<rss version=\\\"2.0\\\" 
      xmlns:geo=\\\"http://www.w3.org/2003/01/geo/wgs84_pos#\\\" 
      xmlns:dc=\\\"http://purl.org/dc/elements/1.1/\\\">\";

    $xml_output .= \"<channel>\";
    $xml_output .= \"<title>My GeoRSS</title>
     <description>Description here</description>
     <link>http://url-here.com/</link>
     <dc:publisher>your_name</dc:publisher>
     <pubDate>Wed,13 Apr 2011 23:56:15 PST</pubDate>
     <item>
       <pubDate>Wed,13 Apr 2011 23:56:15 PST</pubDate>
       <title>Feed title</title>
       <description>Feed description</description>
       <link>Feed URL</link>
       <geo:lat>Latitude</geo:lat>
       <geo:long>Longitude</geo:long>
     </item>
   </channel>
</rss>
\";

print $xml_output;
替换从数据库中获取的各个字段。