アプリ版:「スタンプのみでお礼する」機能のリリースについて

PHPのSmartyを用いて、任意の住所の地図表示を行うテンプレートを作成しています。他の方が作られたサンプルプログラムを元に考えているのですが、地図が表示されないようです。

Smartyテンプレートとして、住所文字列を$event_locationとして格納し、その地図を表示させたいのですが、下記の2つのfunction部分で処理がとまるように見えています。

申し訳ございませんが、どなたか解決方法(下記以外の書き方でもかまいません)を教えて頂けませんでしょうか。
よろしくお願いいたします。

---<googlemap.tpl>-------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dt …
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Google Maps JavaScript API Example - simple</title>
</head>

<script src="http://maps.google.com/maps?file=api&v=2.x&key=G … type="text/javascript" charset="UTF-8"></script>
<body onload="load();showAddress('{$event_location}')">
<div id="map" style="width:450px; height:400px"></div>
<script type="text/javascript">

var map = null;
var geocoder = null;

function load() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.addControl( new GSmallMapControl() );

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>
<div id="map" style="width:500px; height:600px"></div>
</body>
</html>

A 回答 (1件)

JavaScript + Samrty でありがちですが


function load() {
の { は Smartyの構文となってしまいますが回避してますか?

{literal} {} {/literal}
    • good
    • 0
この回答へのお礼

ずばりご指摘の通りでした。
早々のご回答ありがとうございます。

お礼日時:2009/09/10 22:12

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!