Map Markers in a WordPress Google Maps Plugin

20 views
Skip to first unread message

Laxmidi

unread,
Oct 4, 2011, 12:55:27 PM10/4/11
to google-map...@googlegroups.com
Hi,

I'm learning Google Maps and WordPress plugins. I've built a basic Google Maps shortcode plugin. But, I'm having problems placing markers on the map. The map is visible and I've pulled the lat long coordinates from a MySQL database. I'm following the tutorial here.

I'm not sure how to output XML from a WordPress plugin. This a snippet from my plugin:

$dom = new DOMDocument('1.0');
$node
= $dom->createElement('markers');
$parnode
= $dom->appendChild($node);

    $csf_data
= $wpdb->get_results($wpdb->prepare("SELECT  * "));            

       
foreach($csf_data as $incident) {
            $node
= $dom->createElement('marker');
            $newnode
=  $parnode->appendChild($node);
            $newnode
->setAttribute("lat", $incident->latitude);
            $newnode
->setAttribute("lng", $incident->longitude);
       
}

       
die();

        echo $dom
->saveXML;

In the tutorial, the php script is in a separate file and when it runs, it outputs XML. In my case, the code above is in the main plugin file. Also, in the tutorial this: function downloadUrl(url, callback) is used to load the XML file. How do I output the XML to a separate file in WordPress, so that I can use this function?

How do I tell if XML has been output by WordPress?
How do I export the XML to a separate file in WordPress?
How do I load the XML file in WordPress?

Any suggestions? Thank you.

-Laxmidi


Reply all
Reply to author
Forward
0 new messages