Reply To: Generate Map from PHP

Home Forums MapPress Support Generate Map from PHP Reply To: Generate Map from PHP

#15670
Chris
Keymaster

Hi,

Your code is fine – I just put it into my test site and it works to display the map. I think it may not be working for you because of a syntax error:

– Check that you’re not using ‘smart quotes’. Some software like Microsoft Word will replace a basic quote (“) with a fancy quote, which doesn’t work in PHP

Here’s a working copy from my test site – you could try copying and pasting this.


<?php
$mymap = new Mappress_Map(array("width" => 600));

							$mypoi_1 = new Mappress_Poi(array("title" => "Poscode KT17", "body" => "Epsom, Surrey", "point" => array("lat" => 51.34, "lng" => -0.24)));
							$mypoi_2 = new Mappress_Poi(array("title" => "Poscode KT18", "body" => "Epsom, Surrey", "point" => array("lat" => 51.31, "lng" => -0.26)));
							$mymap->pois = array($mypoi_1,$mypoi_2);
							echo $mymap->display();
?>