Directions To Here and From Here in info window
Has anyone figured out how to implement "to here" and "from here" directions in the info window of a map created with ProMaps?
Has anyone figured out how to implement "to here" and "from here" directions in the info window of a map created with ProMaps?
I would imagine that you would need to add in some of the following in a custom infowindow (note that the address variable at the end would probably need to be your actual address or a recordset):
<p><b>Driving Directions</b><br>Enter your start address (street, town, postcode):<form action="http://maps.google.com/maps" method="get" target="_blank">' +
'<input type="text" size=40 maxlength=40 name="saddr" id="saddr" value="" /><br><br>' +
'<input value="Get Directions" type="submit">' +
'<input type="hidden" name="daddr" value="' + address + '"></p>
Yeah... there is an example in the prostores demo of directions to here... from here would be almost identical.
It was added manually after the map was created: AboutUs.php
Ray,
This is exactly what I am looking for. I really like how this example has the form built into the information window. I've looked through all of my Pro Maps pdf files and do not find any reference to this. Do you have a link to some direction on creating this type of map?
Thanks,
TroyD
You can view the javascript source from that page to see how it was done. I couldn't find any references that talk about it.
Kind of complex to explain, but you could probably just apply promaps on your page, then hijack that code from the sample and replace your javascript code ... then just update the address.
Thanks Ray,
I had been examining the javascript on that page. But I wasn't sure if it was acceptable practice for me to copy it. I do believe I understand what I need to do. If not, I will most likely post the page in progress and see if I can get you to look at it.
Thanks again,
TroyD
I am not a php programmer and cannot identify which part of the powerstore-aboutus page code will add the ability of the user to input their address; nor which .js file to use and where in the file the code wold go. Can you be more specific? My site is skandertire.com/directions1.html. Thanks.
Steve
If you aren't a programmer I would copy and paste the entire javascript page and edit the address and API key from there. You won't be able to understand and add individual pieces if you don't understand script in general.
I have modified the code used to work with the pro maps directions method - it re-loads same page with directions included next to map
<?php do { ?>
var address_0_<?php echo $Recordset; ?> = {
street: '<?php echo str_replace("'", "\'", "".$row_Recordset['address0'] .""); ?>',
city: '<?php echo str_replace("'", "\'", "".$row_Recordset['address1'] .""); ?>',
state: '',
zip: '<?php echo str_replace("'", "\'", "".$row_Recordset['postcode'] .""); ?>',
country: 'UK',
infowindow: 'custom',
infowindowtext: '<span style="font: 10px Verdana, Arial, Helvetica, sans-serif; color: black;"><?php echo str_replace("'", "\'", "<strong>GP:</strong> ".$row_Recordset['firstname'] . " " .$row_Recordset['name'] ."<br>".$row_Recordset['email'] .""); ?></span>' +
'<p style="font: 10px Verdana, Arial, Helvetica, sans-serif; color: black;"><b>Distance & directions</b><br><form name="address" method="get">' +
'<label for="postcode">Your postcode:</label> <input type="text" size=10 maxlength=10 name="postcode" id="postcode" value="" />' +
'<input value="Go" type="submit">' +
'<input type="hidden" name="address" value="<?php echo $row_Recordset['postcode']; ?>"></p>',
full: '<?php echo str_replace("'", "\'", "".$row_Recordset['address0'] .""); ?>, <?php echo str_replace("'", "\'", "".$row_Recordset['address1'] .""); ?>, <?php echo str_replace("'", "\'", "".$row_Recordset['postcode'] .""); ?>, UK',
isdefault: false,
addressType: 'address',
loop: 'Recordset',
latitude: '<?php echo str_replace("'", "\'", "".$row_Recordset['grid_east_m'] .""); ?>',
longitude: '<?php echo str_replace("'", "\'", "".$row_Recordset['grid_north_m'] .""); ?>',
markerStyle: 'Google Traditional (flat)',
markerColor: 'Pacifica'
};
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.