1
こんにちは、Googleマップからマップを挿入し、送信フレームワークを使用する際に問題が発生しています。Google Maps Zend Frameworkの問題
私は二回にGoogleマップAPIを取得していますし、何のマップがビューでレンダリングしないされている私の見解にスクリプトを追加するときに私の問題は、しかしQuestion 921811
に似ています。
は、これは私がしかし、これはマップの読み込みに失敗の原因となっているエスケープHTMLの多くは、との2回に分けてマップのAPIを追加して、ビュースクリプト
<?php
$this->headScript()->appendFile('http://maps.google.com/maps?file=api&;v=2&;sensor=true&;key=ABQIAAAAHSJ3TgOTyvA1VzwU8g4Y7RT2yXp_ZAY8_ufC3CFXhHIE1NvwkxRmCy1h3nGv3n46kcqaFljsimqfWw');
$this->headScript()->appendScript(' var map = null;
var geocoder = null;
function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
geocoder = new GClientGeocoder();
}
}
function showAddress(address) {
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + " not found");
} else {
map.setCenter(point, 13);
var marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml(address);
}
}
);
}
}
');
?>
に追加していものです。例えば
<script type="text/javascript" src="<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=true&amp;key=ABQIAAAAHSJ3TgOTyvA1VzwU8g4Y7RT2yXp_ZAY8_ufC3CFXhHIE1NvwkxRmCy1h3nGv3n46kcqaFljsimqfWw" type="text/javascript"></script>"></script>
<script type="text/javascript" src="http://maps.google.com/maps?file=api&;v=2&;sensor=true&;key=ABQIAAAAHSJ3TgOTyvA1VzwU8g4Y7RT2yXp_ZAY8_ufC3CFXhHIE1NvwkxRmCy1h3nGv3n46kcqaFljsimqfWw"></script>
<script type="text/javascript">
//<!--
var map = null;
var geocoder = null;
function initialize() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(37.4419, -122.1419), 13);
geocoder = new GClientGeocoder();
}
}
.....
なぜGoogleマップAPIがエスケープされたhtmlタグで2回追加されているのでしょうか?私には分かりません。私が見つけた例はこの問題を抱えていないようです。あなたのappendFile()
呼び出しでURLが壊れているので、あなたが任意のマップを見ていない理由は、事前
あなたの見解では、JS関連のすべてですか?たとえば、 "echo $ this-> headScript()"のようなものがありますか? このコードを直接ビューに入れると、appendFileやappendScriptなどのメソッドを使用する必要はなく、