VE Team 的个人资料Virtual Earth / Live Map...照片日志列表更多 ![]() | 帮助 |
|
1月11日 Live Search Maps for WordpressCraig Kerwien writes the Terra Incognita blog dedicated to sharing travel adventure stories. He uses WordPress as his blogging platform and recently added a Live Search Maps exploration tool to the site. Try it out then read on below for a few tips on how to add Live Maps to your own WordPress site Here's a quick and easy way to add VE to a page hosted with Wordpress. While the instructions are fairly simple, they do require that you have your own install of Wordpress where you can edit the template source code of your blog theme. This means they will not work with a hosted blogging service, such as on Wordpress.com, where javascript is not permitted. These instructions work with Wordpress v2+. If you run into any nuances, feel free to post a comment below. How it works If you ever tried to copy a VE script and paste it into a new page created with your Wordpress dashboard, you'll discover that you get a garbled mess. The solution is to create a new page template that contains all of the VE code, upload it to your theme directory, then use that template for your new VE page. You'll be able to provide whatever HTML and javascript you want on the page, as long as it sits within the Wordpress page template code. Wordpress page template code <?php VE code goes here <?php get_footer();?> See it in action Here is a simple VE location search: http://terra.incognita.ws/find-a-place/ The page template code for this search is here: <?php <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript" src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6"></script> <script type="text/javascript"> var map = null; function GetMap() { map = new VEMap('myMap'); map.SetDashboardSize(VEDashboardSize.Small); map.SetZoomLevel(1); function FindLoc() { try { map.Find(null, txtWhere.value); } catch(e) { alert(e.message); } } </script> </head> <center> <INPUT id="txtWhere" type="text" name="txtWhere"> <INPUT id="find" type="submit" value="Find" name="find" onclick="FindLoc();"> <br>Try "Glacier National Park", "Area 51", or "Sydney" <br><br> </body> </html> Production instructions
Enjoy! 评论 (38)
VE Team
在此页禁用了评论功能。
引用通告此日志的引用通告 URL 是: http://virtualearth.spaces.live.com/blog/cns!2BBC66E99FDCDB98!10583.trak 引用此项的网络日志
|
|
|