VE Team 的个人资料Virtual Earth / Live Map...照片日志列表更多 工具 帮助
1月11日

Live Search Maps for Wordpress

Craig 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
/*
Template Name: Name of your page template goes here
*/
?>
<?php get_header();?>

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
/*
Template Name: FindPlace
*/
?>
<?php get_header();?>

<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.LoadMap();

         map.SetZoomLevel(1);
      }

      function FindLoc()

      {

         try

         {

            map.Find(null, txtWhere.value);

         }

         catch(e)

         {

            alert(e.message);

         }

      }

      </script>

   </head>

   <center>
   <font face = "tahoma">
   <body onload="GetMap();">

       <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>
     <div id='myMap' style="position:relative; width:500px; height:450px; border: solid 1px black;"></div>

  </body>

</html>
<?php get_footer();?>

Production instructions

  1. Create the page template locally using your favorite text or code editor. Make sure the filename extension is ".php". Example: FindPlace.php
  2. Upload your page template to your blog's theme folder using FTP or related tool. This folder will be the same one containing the default page templates and other theme files. If you have customized the code on your blog, you probably know where this is.
  3. Go to the Dashboard of your blog. Click on the Write menu, then Write Page.
  4. Select the new template from the Page Template: option on the right column. In this example, the template name would be "FindPlace'.
  5. Click the Create New Page button to publish your page. Notice there is no need to insert anything for the page title or page content - the template just publishes the page in its entirety.

Enjoy!

评论 (38)

请稍候...
很抱歉,您输入的评论太长。请缩短您的评论。
您没有输入任何内容,请重试。
很抱歉,我们当前无法添加您的评论。请稍后重试。
若要添加评论,需要您的家长授予您相应权限。请求权限
您的家长禁用了评论功能。
很抱歉,我们当前无法删除您的评论。请稍后重试。
您已超过了一天之内允许提供的评论数上限。请在 24 小时后重试。
因为我们的系统表明您可能在向其他用户提供垃圾评论,您的帐户已禁用了评论功能。如果您认为我们错误地禁用了您的帐户,请联系 Windows Live 支持部门
完成下面的安全检查,您提供评论的过程才能完成。
您在安全检查中键入的字符必须与图片或音频中的字符一致。
VE Team 在此页禁用了评论功能。
没有名字发表:
Wow gold on sale , we are professional world of wOW Gold seller , selling WOW GOld ,We supply cheap wOw Gold, the cheapest wOW Gold , to our loyal and.
7 月 17 日
7 月 16 日
7 月 16 日
7 月 16 日
7 月 15 日
匿名 的图片
7 月 13 日
7 月 11 日
匿名 的图片
(沒有名稱) 发表:
徵信是個富有挑戰的工作,忙碌、刺激、激情。最后的結局總是有人哭,有人笑。在徵信社工作的幾年時間里,我感悟到很多生活的無奈與殘酷。閑暇時我去中古车市场,感覺工作太緊張,放松一下而已,不是純粹的為了淘二手车。私家偵探也就是徵信工作人員似乎是個很酷的詞,但是如果誰需要私家偵探來幫忙的話,他(她)的婚姻也許已經亮起了紅燈。每天陪著星際客戶喝著咖啡,似乎是一件很爽的事,可是她們的眼淚比咖啡要苦的多。常常聽他們說嘈雜的燈光音響麻痹著他們的神經,讓他們過著醉生夢死的生活。其實,誰不渴望幸福美滿的愛情。沒有團體制服不了那些玩弄生活、玩弄感情的人,于是,徵信社應運而生。這不知道是人們的福音還是不幸,希望天下的每一個人都歡樂著、幸福著。坐月子是女人一生的大事,女人可以为了襁褓中的婴儿放弃一直引用的红酒而吃月子餐,这时候的女人是幸福而伟大的。有人歡喜有人優,有人狂笑有人大哭,我不想看到女人太多的眼淚,辭職后,我做了一位安靜、平和的室內設計師。虽然上下班没有了车接车送,但我租车怡然自得。偶爾和ecosway的朋友小聚,很愜意!
7 月 9 日
7 月 8 日
7 月 8 日
7 月 8 日
6 月 29 日
没有名字发表:
EC Engineは、本格ECサイト構築運用のトータルサポートソリューションです。多数の大規模ECサイト構築実績を誇り、多彩な決済SEOCGM機能やカスタマイズによる高い拡張性を有します
6 月 25 日
没有名字发表:
http://www.lingollc.com   toefl L.L.CTOEFL受験者にtoeflに関する情報を提供して、toefl PBT 対策とtoefl ITP(団体受験)対策を総合的にサポートします
6 月 25 日
没有名字发表:
不動産,  賃貸,real estate,部屋探し, 不動産投資,住宅,工場,倉庫,売地,相場,売買,駐車場,地域,路線,家賃,情報,部屋探し,借りる,買う,  賃貸物件,売買物件,一戸建て,マンション,アパート,店舗,事務所,土地,売買 
6 月 25 日
没有名字发表:

香川県 不動産平成20年4月竣工のマンションです。広島 不動産 11階東南角部屋、1103号です。最上階、... 香川県 不動産収納やバスルーム・洗面所などの水廻り、サービスルーム(6帖)など、広島 不動産 個々のスペースをたっぷりと確保した中住戸タイプです。

6 月 23 日
没有名字发表:
広島 不動産不動産 広島,岡山/四国(香川,徳島,愛媛,高知) -あなぶき不産ナビ不動産 広島四国4県、岡山の不動産、広島 不動産広島の不動産など不動産情報検索(マンション・一戸建て・土地・収益物件等広島 不動産 )サイトです。穴吹不動産流通株式会社"
6 月 23 日
没有名字发表:

盲導犬ユーザーの皆さまが大手ECサイトで商品をご購入される際盲導犬、グリーンクリックを経由していただくだけで、盲導犬 ECサイトから支払われるグリーンクリックへのアフィリエイトをご指定の団体へ寄付できるサービスです盲導犬。グリーンクリックを利用することで盲導犬、商品の購入価 格が変わったり盲導犬、寄付の代行手数料が別途か

6 月 23 日
没有名字发表:

キャッシュバック 即日当社の提供するキャッシュバックとは、当社の販売する商品をクレジットカード決済でご購入頂き、キャッシュバック 即日お客様ご指定の口座にご購入金額の最高99.5%を入金するシステムです。

6 月 23 日
匿名 的图片
6 月 22 日

引用通告

此日志的引用通告 URL 是:
http://virtualearth.spaces.live.com/blog/cns!2BBC66E99FDCDB98!10583.trak
引用此项的网络日志