开发者

Markers on a Google Map: With or Without XML

开发者 https://www.devze.com 2023-04-10 10:16 出处:网络
I\'m building a WordPress plugin that pulls lat longs from a MySQL database and places markers on a map. I\'m following this tutorial.

I'm building a WordPress plugin that pulls lat longs from a MySQL database and places markers on a map. I'm following this tutorial.

It says that:

Note: Some tutorials may suggest actually writing your map page as a PHP file and outputting JavaScript for each marker you want to create, but that technique can be problematic. By using an XML file as an intermediary between your database and your Google Map, it makes for a faster initial page load, a more flexible map application, and easier debugging. You can independently verify the XML output from the database and the JavaScript parsing of 开发者_StackOverflow社区the XML. And at any point, you could even decide to eliminate your database entirely and just run the map based on static XML files.

Is this correct? Is it better to create an XML file, and parse it with javascript in order to build the markers? Would it be better to pull the coordinates from the database, and build the markers in javascript without having to build an XML file.

The article was originally written a few years ago. I just want to confirm that this is the best strategy as it will be a pain for me to figure out how to work with XML in WordPress. But, if using XML is the best option, then I'll do that.

Any advice?

Thank you.


In the end, I went ahead and created the XML file as Google suggested.

0

精彩评论

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