午夜国产狂喷潮在线观看|国产AⅤ精品一区二区久久|中文字幕AV中文字幕|国产看片高清在线

    如何在帝國cms中標(biāo)注百度地圖
    來源:易賢網(wǎng) 閱讀:885 次 日期:2014-10-31 08:50:13
    溫馨提示:易賢網(wǎng)小編為您整理了“如何在帝國cms中標(biāo)注百度地圖”,方便廣大網(wǎng)友查閱!

    第一步,確定一個(gè)放具體地址的字段,可以新建立一個(gè)地段如address,具體是在系統(tǒng)>>管理數(shù)據(jù)表里面可以添加自定義字段 ,我是用帝國本身空余下來的字段ftitle,也就是副標(biāo)題,這個(gè)字段我沒有派送用場,空在那里就利用起來吧:

    第二步,建立一個(gè)新的模板變量,變量名自定義,我的變量名:[!--temp.ditu--] 變量標(biāo)識(shí):百度地圖

    接下來在模板變量中加入下面的代碼:

    <!doctype html>

    <html>

    <head>

    <meta http-equiv=”Content-Type” content=”text/html; charset=uft-8″>

    <title>百度地圖坐標(biāo)采集</title>

    <!–[if IE 6]>

    <script type=”text/javascript” src=”http://dev.baidu.com/wiki/static/map/tuan/js/DD_belatedPNG_0.0.8a-min.js”></script>

    <script>DD_belatedPNG.fix(“#float_search_bar”);</script>

    <![endif]–>

    <style>

    #preview{

    border: 1px solid #bfd2e1;

    width: 300px;

    height: 300px;

    font-family: Arial, Helvetica, sans-serif,”宋體”;

    }

    #map_container{

    height: 300px;

    }

    #float_search_bar{

    z-index: 2012;

    position: absolute;

    width: 180px;

    height: 31px;

    background: url(“http://dev.baidu.com/wiki/static/map/tuan/images/search_bar.png”) repeat-x;

    background-position: 0 -21px;

    padding: 3px 0 0 10px;

    }

    #float_search_bar label, #float_search_bar span{

    color: #0787cb;

    font-size: 14px;

    }

    #float_search_bar input{

    width: 180px;

    height: 16px;

    margin-top: 1px;

    }

    #float_search_bar input:focus{

    outline: none;

    }

    #float_search_bar button{

    border: 0;

    color: white;

    width: 77px;

    height: 20px;

    background: url(“http://dev.baidu.com/wiki/static/map/tuan/images/search_bar.png”) no-repeat;

    background-position: 0 0;

    margin-right: 5px;

    cursor: pointer;

    }

    </style>

    </head>

    <body>

    <div id=”preview”>

    <div id=”float_search_bar”>

    <label>區(qū)域:</label>

    <input type=”text” id=”keyword” />

    <button id=”search_button”>查找</button>

    <span>點(diǎn)擊地圖或標(biāo)注獲取坐標(biāo)</span>

    </div>

    <div id=”map_container”></div>

    </div>

    <div id=”result” style=”margin-top: 4px;”></div>

    <script type=”text/javascript” src=”http://api.map.baidu.com/api?v=1.2″></script>

    <script type=”text/javascript”>

    function getUrlParas(){

    var hash = location.hash,

    para = {},

    tParas = hash.substr(1).split(“&”);

    for(var p in tParas){

    if(tParas.hasOwnProperty(p)){

    var obj = tParas[p].split(“=”);

    para[obj[0]] = obj[1];

    }

    }

    return para;

    }

    var para = getUrlParas(),

    center = para.address?decodeURIComponent(para.address) : “[!--ftitle--]“,

    city = para.city?decodeURIComponent(para.city) : “[!--city--]“;

    document.getElementById(“keyword”).value = center;

    var marker_trick = false;

    var map = new BMap.Map(“map_container”);

    map.enableScrollWheelZoom();

    var marker = new BMap.Marker(new BMap.Point(116.404, 39.915), {

    enableMassClear: false,

    raiseOnDrag: true

    });

    marker.enableDragging();

    map.addOverlay(marker);

    map.addEventListener(“click”, function(e){

    if(!(e.overlay)){

    map.clearOverlays();

    marker.show();

    marker.setPosition(e.point);

    setResult(e.point.lng, e.point.lat);

    }

    });

    marker.addEventListener(“dragend”, function(e){

    setResult(e.point.lng, e.point.lat);

    });

    var local = new BMap.LocalSearch(map, {

    renderOptions:{map: map},

    pageCapacity: 1

    });

    local.setSearchCompleteCallback(function(results){

    if(local.getStatus() !== BMAP_STATUS_SUCCESS){

    alert(“沒有獲取到數(shù)據(jù)”);

    } else {

    marker.hide();

    }

    });

    local.setMarkersSetCallback(function(pois){

    for(var i=pois.length; i–; ){

    var marker = pois[i].marker;

    marker.addEventListener(“click”, function(e){

    marker_trick = true;

    var pos = this.getPosition();

    setResult(pos.lng, pos.lat);

    });

    }

    });

    window.onload = function(){

    local.search(center);

    document.getElementById(“search_button”).onclick = function(){

    local.search(document.getElementById(“keyword”).value);

    };

    document.getElementById(“keyword”).onkeyup = function(e){

    var me = this;

    e = e || window.event;

    var keycode = e.keyCode;

    if(keycode === 9){

    local.search(document.getElementById(“keyword”).value);

    }

    };

    };

    function a(){

    document.getElementById(“float_search_bar”).style.display = “none”;

    }

    a();

    /*

    * setResult : 定義得到標(biāo)注經(jīng)緯度后的操作

    * 請(qǐng)修改此函數(shù)以滿足您的需求

    * lng: 標(biāo)注的經(jīng)度

    * lat: 標(biāo)注的緯度

    */

    function setResult(lng, lat){

    document.getElementById(“result”).innerHTML = lng + “, ” + lat;

    }

    </script>

    </body>

    </html>

    需要修改的地方已經(jīng)用紅色標(biāo)注,注意查看

    以上代碼是一個(gè)完整的html代碼,實(shí)際應(yīng)用中您可以把head中的內(nèi)容提取出來,放到內(nèi)容頁面模板的head中,然后去掉head body html這些標(biāo)簽即可。

    更多信息請(qǐng)查看IT技術(shù)專欄

    更多信息請(qǐng)查看CMS教程
    易賢網(wǎng)手機(jī)網(wǎng)站地址:如何在帝國cms中標(biāo)注百度地圖
    由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!
    相關(guān)閱讀CMS教程

    2025國考·省考課程試聽報(bào)名

    • 報(bào)班類型
    • 姓名
    • 手機(jī)號(hào)
    • 驗(yàn)證碼
    關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺(tái) | 手機(jī)站點(diǎn) | 投訴建議
    工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
    云南網(wǎng)警備案專用圖標(biāo)
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號(hào):hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)
    云南網(wǎng)警報(bào)警專用圖標(biāo)