This topic is locked

Redirect to google map

11/5/2011 1:19:42 PM
PHPRunner General questions
C
cjsaputo author

I want to place a map button on a listing screen that will call up a google map of the record based on address. I can get the button on the screen but it won't do anything. With the new version of Google maps no key is required. I tried the code from the google examples ut still nothing. Any help would be appreciated.
By the way, I am using PHP Runner.
Chuck

C
cgphp 11/5/2011

Post your code.

C
cjsaputo author 11/5/2011



Post your code.



According to Google the following code will work in standard html:
http://maps.googleapis.com/maps/api/staticmap?center=Berkeley,CA&zoom=14&size=400x400&sensor=false
I need to be able to call this somehow when the user presses the map button. Of course I would also be sending variables, street, city, zip instead of the hard coded city and state.
Thanks,Chuck

C
cgphp 11/6/2011

Create a custom field on the list page and enter this code:

$address = urlencode($data['address'].",".$data['city'].",".$data['zip']);
$value = "<input type='button' value='MAP' onclick=\"window.open('http://maps.googleapis.com/maps/api/staticmap?center=".$address."&zoom=20&size=400x400&sensor=false','MAP','status = 1, height = 400, width = 400, resizable = 0'); return false;\"/>";
C
cjsaputo author 11/6/2011

I'm sorry but I don't know what you mean by create a custom field. I only see Insert "Button", "Google map" or "PHP code snippet".



Create a custom field on the list page and enter this code:

$address = urlencode($data['address'].",".$data['city'].",".$data['zip']);
$value = "<input type='button' value='MAP' onclick=\"window.open('http://maps.googleapis.com/maps/api/staticmap?center=".$address."&zoom=20&size=400x400&sensor=false','MAP','status = 1, height = 400, width = 400, resizable = 0'); return false;\"/>";


C
cgphp 11/7/2011

In the Query tab create an alias for one of the field of the SQL query:

SELECT

city,

address,

zip,

...

...

...

zip as map

FROM table_name


In the Fields tab, set the new map alias to be showed only on the List page.
In the Editor set the new map alias as Custom. Read this article to do this: http://xlinesoft.com/phprunner/docs/_view_as__settings_custom.htm