and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I'm confused as to how to get an argument from one function to another... or how to solve my issue here. When I run this, it throws a js error "marker is undefined". Anyone have any thoughts as to how I could get this loop to work?I'm trying to pass the info into the text "bubbles" that appear when you click on the marker.
[syntax="javascript"]
var map = null;
var geocoder = null;
<?php
$key = 0;
foreach($results as $key => $contact) {
$results[$key][javavarname] = "address$key";
$varString = "var address$key = \"$contact[address1], $contact[city], $contact[state], $contact[zip]\";\n";
echo $varString;
$key++;
}
?>
function markAddress(address) {
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
// alert(address + " not found");
} else {
map.setCenter(point, 7);
var marker = new GMarker(point);
map.addOverlay(marker);
}
}
);
}
}
function load() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
geocoder = new GClientGeocoder();
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
<?
foreach($results as $contact) {
echo "markAddress(" . $contact[javavarname] . ");\n";
echo "GEvent.addListener(marker, \"click\", function() {\n";
echo "marker.openInfoWindowHtml(" . $contact[javavarname] . ");\n";
echo "});\n";
}
?>
}
}
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Last edited by hydroxide on Fri Jul 21, 2006 9:01 am, edited 2 times in total.
I'm not sure if the way the PHP is set up is the problem. I'm getting the proper output from my php file. You can see for yourself here http://myels.com/testing/jimmy/workdash.php. I'm out of ideas
Well, now I changed it to use global variables, but it throws an error "'__e_' is null or not an object. This is really weird. You can see for yourself http://myels.com/testing/jimmy/workdash.php