구글 지도 멀티 마커 질문드립니다..
본문
각 게시물의 <?=$view['content']?> 에서 주소값을 받아 각 게시물 별로 구글 지도를 표출 해주는 소스입니다.
아래소스는 단순히 <?=$view['content']?> 한주소만을 가져와서 구글지도에 표출시키는데요.
특정 게시판 " shop " 이라는 게시판의 특정 필드 " content " 로 된 모든 값을 가져와
다중적으로 구글 지도에 마크를 할 수 있을까요?
(게시판내에서가 뷰 페이지가 아닌, 개별적)
<!-- 구글지도 -->
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<script src="http://maps.google.com/maps?file=api&v=1&sensor=true&key=<?=$api_key?>" type="text/javascript"></script>
<script type="text/javascript">
var map = null;
var geocoder = null;
function initialize()
{
if (GBrowserIsCompatible())
{
map = new GMap2(document.getElementById("map_canvas")); //지도를 표시할 영역지정하여 map인스턴스 생성
map.setUIToDefault();
geocoder = new GClientGeocoder();
showAddress("<?=$view['content']?>"); //실제 주소를 날리고 좌표를 콜백받아 처리할 함수
}
}
function showAddress(address) {
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + " not found");
} else {
map.setCenter(point, 16);
var marker = new GMarker(point);
map.addOverlay(marker); //지도좌표에 표시할 마크
marker.openInfoWindowHtml(" <?
?><?=$view['wr_subject']?><br>☎ <?=$view['wr_1']?>"); //이미지 함수변경함 첫번째 이미지가 구글 지도에 들어가게 설정함 wr_2는 간단설명 호줄받게함
}
}
);
}
}
</script>
<!-- 구글지도 -->
답변을 작성하시기 전에 로그인 해주세요.