<script type="text/javascript">
function mgminfomap(){
var myOptions = {
zoom: 3,
//center: new google.maps.LatLng(27.3114655, 90.94384680000007),
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById('mgmap'), myOptions);
var locations = [
<? for ($i=0; $i<count($list); $i++) {
$name1=strip_tags($list[$i][subject]);
$lat=($list[$i][wr_3]);
$lng=($list[$i][wr_4]);
$address=strip_tags($list[$i][wr_2]);
$phone=strip_tags($list[$i][wr_content]);
$url=strip_tags($list[$i][wr_link]);
$mapnum=($list[$i][wr_id]);
$mtem="<table><tr><td colspan=2 width=300><a href={$list[$i][href]}><h3>$name1</h3></a></td></tr><tr><td width=70>주소: </td><td width=230>{$address}</td></tr><tr><td width=70>전화번호: </td><td width=230>{$phone}</td></tr></table>";
?>
['<?=$mtem?>', '<?=$lat?>', '<?=$lng?>', '<?=$mapnum?>']
<? if ($i==count($list)-1) continue; ?>
,
<? } ?>
];
var infowindow = new google.maps.InfoWindow();
var marker, i;
var bounds = new google.maps.LatLngBounds();
for (i = 0; i < locations.length; i++) {
var myLatLng = new google.maps.LatLng(locations[i][1], locations[i][2]);
var marker = new google.maps.Marker({
position: myLatLng,
map: map
});
bounds.extend(myLatLng);
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
}
zoomChangeBoundsListener = google.maps.event.addListener(map, "bounds_changed",function(event){
if(this.getZoom() > 20)
this.setZoom(16);
google.maps.event.removeListener(zoomChangeBoundsListener);
});
map.fitBounds(bounds);
}
google.maps.event.addDomListener(window, 'load', mgminfomap);
</script>
<!--지도 끝 -->
질문입니다!
$mtem="<table><tr><td colspan=2 width=300><a href={$list[$i][href]}><h3>$name1</h3> 여기에서
h3글씨 눌렀을때
a링크가 target="_blank"로 새창으로 열리게 하고싶은데
<a target='_blank' href={$list[$i][href]}><h3>$name1</h3> 이런식으로 수정해봤는데
지도가 아예안뜨네요
a링크 클릭시 새창으로 열리게 하려면 어케해야되나요
답변 1개 / 댓글 1개
$list[$i]['href'] 이거는 그냥 해당 게시물 주소 아닌가요?
view.skin.php 파일 안에도 지도 관련된 js 코드 넣으셔야 할 것 같습니다.
답변에 대한 댓글 1개
답변을 작성하려면 로그인이 필요합니다.
소스 보기로 해서 target="_blank" 정상적으로 적용되어 있는지 보셔야 할 것 같네요.