묻고답하기

현재 제로보드에 포함된 네이버맵은 구버전이라 새버젼(현재 네이버에서 사용되는 맵)을 사용하고 싶어서
검색해보다가 http://dev.naver.com/openapi/apis/map/map2GuideBeta 여기 중간쯤에

3. 수정, 추가된 API Reference

   아래는 새롭게 수정되거나 추가된 내용들 입니다. 나머지는 기존 API Reference와 동일하므로 그대로 사용하실 수 있습니다.

   지도API 2.0(베타)를 사용하시려면 maps.naver.com을 map.naver.com으로 수정을 하셔야 합니다.


이렇게 나와있길래
<?php
    /**
     * @class  naver_map
     * @author zero (zero@nzeo.com)
     * @brief  본문에 네이버의 지도 open api로 지도 삽입
     **/
    class naver_map extends EditorHandler { 
        // upload_target_srl 는 에디터에서 필수로 달고 다녀야 함....
        var $upload_target_srl = 0;
        var $component_path = '';
        // 네이버맵 openapi 키 값
        var $api_key = '';
        /**
         * @brief upload_target_srl과 컴포넌트의 경로를 받음
         **/
        function naver_map($upload_target_srl, $component_path) {
            $this->upload_target_srl = $upload_target_srl;
            $this->component_path = $component_path;
        }
        /**
         * @brief popup window요청시 popup window에 출력할 내용을 추가하면 된다
         **/
        function getPopupContent() {
            // 템플릿을 미리 컴파일해서 컴파일된 소스를 return
            $tpl_path = $this->component_path.'tpl';
            if(!$this->api_key) $tpl_file = 'error.html';
            else $tpl_file = 'popup.html';
            Context::set("tpl_path", $tpl_path);
            $oTemplate = &TemplateHandler::getInstance();
            return $oTemplate->compile($tpl_path, $tpl_file);
        }
        /**
         * @brief naver map open api에서 주소를 찾는 함수
         **/
        function search_address() {
            $address = Context::get('address');
            if(!$address) return new Object(-1,'msg_not_exists_addr');
            Context::loadLang($this->component_path."lang");
            // 지정된 서버에 요청을 시도한다
            $query_string = iconv("UTF-8","EUC-KR",sprintf('/api/geocode.php?key=%s&query=%s', $this->api_key, $address));
            $fp = fsockopen('maps.naver.com', 80, $errno, $errstr);
            if(!$fp) return new Object(-1, 'msg_fail_to_socket_open');
            fputs($fp, "GET {$query_string} HTTP/1.0\r\n");
            fputs($fp, "Host: maps.naver.com\r\n\r\n");
            $buff = '';
            while(!feof($fp)) {
                $str = fgets($fp, 1024);
                if(trim($str)=='') $start = true;
                if($start) $buff .= trim($str);
            }
            fclose($fp);
            $buff = trim(iconv("EUC-KR", "UTF-8", $buff));
            $buff = str_replace('<?xml version="1.0" encoding="euc-kr" ?>', '', $buff);
            $oXmlParser = new XmlParser();
            $xml_doc = $oXmlParser->parse($buff);
            $addrs = $xml_doc->geocode->item;
            if(!is_array($addrs)) $addrs = array($addrs);
            $addrs_count = count($addrs);
            $address_list = array();
            for($i=0;$i<$addrs_count;$i++) {
                $item = $addrs[$i];
                $address_list[] = sprintf("%s,%s,%s", $item->point->x->body, $item->point->y->body, $item->address->body);
            }
            $this->add("address_list", implode("\n", $address_list));
        }
        /**
         * @brief 에디터 컴포넌트가 별도의 고유 코드를 이용한다면 그 코드를 html로 변경하여 주는 method
         *
         * 이미지나 멀티미디어, 설문등 고유 코드가 필요한 에디터 컴포넌트는 고유코드를 내용에 추가하고 나서
         * DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경
         *
         * 네이버 지도 open api 는 doctype에 대한 오류 및 기타 등등등등의 문제 때문에 iframe 을 만들고 컴포넌트를 다시 호출해서 html을 출력하게 한다.
         * 네이버 지도 open api 가 xhtml1-transitional.dtd 를 지원하게 되면 다시 깔끔하게 고쳐야 함..
         * 2006년 3월 12일 하루 다 날렸다~~~ ㅡ.ㅜ
         **/
        function transHTML($xml_obj) {
            $x = $xml_obj->attrs->x;
            $y = $xml_obj->attrs->y;
            $marker = $xml_obj->attrs->marker;
            $style = $xml_obj->attrs->style;
            preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i',$style,$matches);
            $width = trim($matches[3][0]);
            $height = trim($matches[3][1]);
            if(!$width) $width = 400;
            if(!$height) $height = 400;
            $body_code = sprintf('<div style="width:%dpx;height:%dpx;margin-bottom:5px;"><iframe src="%s?module=editor&amp;act=procEditorCall&amp;method=displayMap&amp;component=naver_map&amp;width=%s&amp;height=%s&amp;x=%s&amp;y=%s&amp;marker=%s" frameBorder="0" style="padding:1px; border:1px solid #AAAAAA;width:%dpx;height:%dpx;margin:0px;"></iframe></div>', $width, $height, Context::getRequestUri(), $width, $height, $x, $y, $marker, $width, $height);
            return $body_code;
        }
        function displayMap() {
            $id = "navermap".rand(11111111,99999999);
            $width = Context::get('width');
            if(!$width) $width = 640;
            $height = Context::get('height');
            if(!$height) $height = 480;
            $x = Context::get('x');
            if(!$x) $x = 321198;
            $y = Context::get('y');
            if(!$y) $y = 529730;
            $marker = Context::get('marker');
            $html = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">'.
                    '<html>'.
                    '<head>'.
                    '<title></title>'.
                    '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'.
                    '<script type="text/javascript" src="/common/js/x.js"></script>'.
                    '<script type="text/javascript" src="http://maps.naver.com/js/naverMap.naver?key='.$this->api_key.'"></script>'.
                    '<script type="text/javascript">'.
                    'function moveMap(x,y,scale) {mapObj.setCenterAndZoom(new NPoint(x,y),scale);}'.
                    'function createMarker(pos) { if(typeof(top.addMarker)=="function") { if(!top.addMarker(pos)) return; var iconUrl = "http://static.naver.com/local/map_img/set/icos_free_"+String.fromCharCode(96+top.marker_count-1)+".gif"; var marker = new NMark(pos,new NIcon(iconUrl,new NSize(15,14))); mapObj.addOverlay(marker); } }'.
                    '</script>'.
                    '</head>'.
                    '<body style="margin:0px;">'.
                    '<div id="'.$id.'" style="width:'.$width.'px;height:'.$height.'px;"></div>'.
                    '<script type="text/javascript">'.
                    'var mapObj = new NMap(document.getElementById("'.$id.'+
 '+
 '"));'.
                    'mapObj.addControl(new NSaveBtn());'.
                    'var zoom = new NZoomControl();'.
                    'zoom.setValign("bottom");'.
                    'mapObj.addControl(zoom);'.
                    'var infowin = new NInfoWindow();'.
                    'mapObj.addOverlay(infowin);'.
                    'NEvent.addListener(mapObj,"click",createMarker);'.
                    '';
            if($x&&$y) $html .= '+
 'mapObj.setCenterAndZoom(new NPoint('.$x.','.$y.'),3);';  
            if($marker) {
                $marker_list = explode('|@|', $marker);
                $icon_no = 0;
                for($i=0;$i<count($marker_list);$i++) {
                    $pos = trim($marker_list[$i]);
                    if(!$pos) continue;
                    $icon_url = 'http://static.naver.com/local/map_img/set/icos_free_'.chr(ord('+
 'a')+$icon_no).'.gif';
                    $html .= 'mapObj.addOverlay( new NMark(new NPoint('.$pos.'),new NIcon("'.$icon_url.'",new NSize(15,14))) );';
                    $icon_no++;
                }
            }
            $html .= ''.
                     //'mapObj.enableWheelZoom();'.
                     'NEvent.addListener(mapObj, "click", function(pos) { if(typeof(top.mapClicked)!="undefined") top.mapClicked(pos); });'.
                     'NEvent.addListener(mapObj, "mouseup", function(pos) { if(typeof(top.mapClicked)!="undefined") top.mapClicked(pos); });'.
                     '</script>'.
                     '</body>'.
                     '</html>';
            print $html;
            exit();
        }
    }
?>


코드에 빨강부분 3부분 maps.naver.com을 map.naver.com으로 수정했는데 지도가 안나오네요

다른부분도 손봐줘야 하나요??

원래는 위에 3부분을 수정했더니 잠깐은 뜨더니 나중에 안뜨더라구요..

여러분들 도와주세요

글쓴이 제목 최종 글
XE 공지 글 쓰기,삭제 운영방식 변경 공지 [16] 2019.03.05 by 남기남
최귀성249 라운드하우스_레이아웃_가로폭좁히기 (도와주세요) [2] file 2009.02.26 by 최귀성249
쿄우짱짱 사랑비 BGM을 달았는데요.. [3] 2009.02.26 by 쿄우짱짱
알고시포요ㅠ 로그인 위젯 관련 [3] 2009.02.26 by 알고시포요ㅠ
김용중 상하로 움직이는 퀵메뉴관련 [1] 2009.02.26 by 닝기리쓰레빠
최소영329 회원가입 ko.lang.php파일 글자 수정후 오류메세지(파일)이 나타납니다?(modules/member/lang ) [1] 2009.02.26 by 닝기리쓰레빠
edgarkim xe 사용하고 있는데, erd 가지고 계신분 있으신가요? [3] 2009.02.26 by edgarkim
질문 로그인폼에 로그인/패스워드 글자 미리 적혀있게 하는 법  
박병철597 제로보드 xe 납치태그안먹히나요?  
주시영 정말 모르겠습니다 포인트질문  
전국일등 width를 100%로했는데도 하얀부분이.. [1] file 2009.02.26 by Habile
endolphiner 최근글 추출 스킨이 먹히질 않네요 [2] 2009.02.26 by endolphiner
SeungRi Cute FTP 3.0 [3] 2009.02.26 by ㄴㅇㄹ
세츠나 글별, 게시판별 비번 설정은 안되나요?  
늦바람 저도 로그인이 안돼서 골치가 아픕니다. [1] 2009.02.26 by 넨네
늘같이 euc-kr 문서를 utf-8로 변환하는 방법은 없나요? [2] 2009.02.25 by fantastic_w
최소영329 답글 작성 및 댓글에서 알림글,비밀글은 뭐가 다르지요 [1] 2009.02.25 by 띵야
NCS 회원가입시 메일을 통해 인증받게하고 싶습니다(Nmail설치) file  
퓨냐 초보적인 질문입니다.. :D  
튀긴건빵 게시글 추천버튼을 게시글내에.. [1] 2009.02.25 by 궁금이2
최소영329 스크랩,작성글,저장함 보기 없애는것중 login_info.html에는 없어요.? [1] 2009.02.25 by 궁금이2
상후니 플래시로 현재 로그인회원수, 전체회원수를 불러오는 방법?  
moog 게시판 게시글 작성시 제목넣는 부분 없애는 방법 [1] 2009.02.25 by 궁금이2
웰즈 탭 형태 최근문서 출력, 출력 개수 변경 [1] 2009.02.25 by 백성찬
상큼하기 ★ DB & 관리자 정보 입력 오류 질문 있습니다. [12] file 2009.02.25 by 상큼하기
조용현596 xe에서 소리라떼 사용하기 불가능? [1] 2009.02.25 by 자이제로
0su 슬라이드 갤러리 크기 변경  
왜만지냐 네이버맵 컨포넌트 질문입니다. [1] 2009.02.25 by 왜만지냐
miso777 포인트랭킹 간격이 너무 넓어요 [6] file 2009.02.25 by 만쓰별(정만)
민지a 게시물 다른 게시판으로 이동하는 방법좀 알려주세요 ㅠㅠ [1] 2009.02.25 by 넨네
최소영329 로그인폼에서 스크랩,저장함,작성글 보기 없애는 방법 없나요? [1] 2009.02.25 by 넨네