I have tried to create 2 maps based on different geocodes but i decided to use 2 scripts to try to rectify the problem, but to no avail. I know this may be a simple problem with my code but any suggestions would be helpful.
Here is my code
<?php
$tabTitle = ' | Maps';
$pageIntroductionHeading = 'Maps';
$pageIntroductionContent = 'Maps';
$column1Heading = 'London';
$column2Heading = 'New York';
$column3Heading = 'Paris';
require_once 'header.php';
require_once 'navigationMenu.php';
?>
<?php require_once 'getWeather.php'; ?>
<?php require_once 'getExchangeRates.php'; ?>
<?php require_once 'pageIntroduction.php'; ?>
<div id="obsah" class="content box">
<div class="in">
<div class="shadow">
<img src="./img/threeCities.jpg" alt="Three Cities Banner" title="Three Cities" class="thumb" />
</div>
<ul class="columns">
<li class="col1">
<h3><?php
if (isset($column1Heading)) {
echo $column1Heading;
}
?></h3>
<p>
</br>
<script type="text/javascript" src="//maps.googleapis.com/maps/api/js?sensor=true&libraries=places"></script>
<script type="text/javascript">
var map;
var infowindow;
function initialize() {
var london = new google.maps.LatLng(51.5069999695, -0.142489999533);
map = new google.maps.Map(document.getElementById('map'), {
mapTypeId: google.maps.MapTypeId.ROADMAP,
center:london,
zoom: 10
});
var request = {
location: london,
radius: 5000
};
infowindow = new google.maps.InfoWindow();
var service = new google.maps.places.PlacesService(map);
service.search(request, callback);
}
function callback(results, status) {
if (status == google.maps.places.PlacesServiceStatus.OK) {
for (var i = 0; i < results.length; i++) {
createMarker(results[i]);
}
}
}
function createMarker(place) {
var placeLoc = place.geometry.location;
var marker = new google.maps.Marker({
animation: google.maps.Animation.DROP,
map: map,
position: place.geometry.location
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(place.name);
infowindow.open(map, this);
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map" style="width: 290px; height: 300px;"></div>
<div id="text"></div>
</body>
</br>
</p>
</li>
<li class="col2">
<h3><?php
if (isset($column2Heading)) {
echo $column2Heading;
}
?></h3>
<p>
<script type="text/javascript">
var map1;
var infowindow;
function initialize() {
var nyc = new google.maps.LatLng(40.79445,-74.01558);
map1 = new google.maps.Map(document.getElementById('map1'), {
mapTypeId: google.maps.MapTypeId.ROADMAP,
center:nyc,
zoom: 10
});
var request = {
location: nyc,
radius: 5000
};
infowindow = new google.maps.InfoWindow();
var service = new google.maps.places.PlacesService(map1);
service.search(request, callback);
}
function callback(results, status) {
if (status == google.maps.places.PlacesServiceStatus.OK) {
for (var i = 0; i < results.length; i++) {
createMarker(results[i]);
}
}
}
function createMarker(place) {
var placeLoc = place.geometry.location;
var marker = new google.maps.Marker({
animation: google.maps.Animation.DROP,
map: map1,
position: place.geometry.location
});
google.maps.event.addListener(marker1, 'click', function() {
infowindow.setContent(place.name);
infowindow.open(map1, this);
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</br>
<body>
<div id="map1" style="width: 290px; height: 300px;"></div>
<div id="text"></div>
</body>
</p>
</li>
<li class="col3">
<h3><?php
if (isset($column3Heading)) {
echo $column3Heading;
}
?></h3>
<p>
</br>
</br>
</p>
</li>
</ul>
<div class="clear"></div>
</div>
<?php require_once 'footer.php'; ?>

New Topic/Question
Reply


MultiQuote




|