I'm trying to get a list of properties (that are brought in from an XML file) to be displayed on a map. I've had a search through and nothing has really helped. The problem I'm having is its going through the loop and just returning the last result which is plotted on the map but the other 9 are omitted. Can anyone help me?
<ol class="plist">
<?php foreach($xml_search as $property) {
if(isset($property->id)) {
?>
<li class="plist1">
<a href="particulars.php?propertyID=<?php echo $property->id ?>"><?php echo $property->address->street ?>, <?php echo $property->address->town ?></a>
-
<?php if($property->status == "Available"){ ?>
<span class="available"><?php echo $property->status ?></span>
<?php } ?>
<?php if($property->status != "Let Subject to Contract"){ ?>
<?php if($property->status != "Available"){ ?>
<span class="notAvailable"><?php echo $property->status ?></span>
<?php } ?>
<?php } ?>
<?php if($property->status == "Let Subject to Contract"){ ?>
<span class="notAvailable">Let STC</span>
<?php } ?>
<br />
<strong>£<?php echo number_format($property->price); ?> <?php if ($query=="false") { ?> PCM<?php } ?></strong>, <?php echo $property->bedrooms ?> Bed <?php echo $property->type ?>
</li>
<script type="text/javascript">
var myLatlng = new google.maps.LatLng(<?php echo $property->address->latitude ?>,<?php echo $property->address->longitude ?>);
var myOptions = {
zoom: 10,
center: new google.maps.LatLng(<?php echo $property->address->latitude; ?>, <?php echo $property->address->longitude; ?>),
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var marker = new google.maps.Marker({
position: myLatlng,
title:"<?php echo $property->address->advertising ?>",
clickable: true,
icon: 'images/mapicon.png'
});
var map = new google.maps.Map(document.getElementById("map_canvas_1"),
myOptions);
marker.setMap(map);
</script>
<?php } } //end foreach ?>
</ol>