Ok. i'm pulling data from a mysql db using php and placing the
locations on a map shown below. i'm trying to get it to where when I
click on a link where it's displaying the listings it opens up an info
window that coresponds to the link i clicked.
<?php /
**************************MAP*****************************************/ ?
>
<script src="http://maps.google.com/maps?file=api&v=1
&key=ABQIAAAAwck-
cJHtWqhCPpb7YdIbxxQ330Nr9P2bWxzoQ7lYE8aZnHHG8BSpAUR9xgtcnWMX5AM2ZXmnKrqO1Q"
type="text/javascript">
</script>
<?php
while($rowx = mysql_fetch_array($xerrs))
{
$lat = $rowx['latitude'];
$lon = $rowx['longitude'];
}
?>
<style type="text/css">
#mapcontainer {
position: relative;
top:0px;
left:0px;
overflow:hidden;
z-index:95;
}
</style>
<div id="mapcontainer"><div id="map" style="width: 300px; height:
300px; text-align:center;margin-bottom:10px;"></div></div>
<script type="text/javascript">
//<![CDATA[
var map = new GMap(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.centerAndZoom(new GPoint(<?php echo $lon; ?>, <?php echo $lat; ?
>), 5);
baseIcon = new GIcon(G_DEFAULT_ICON);
baseIcon.iconSize = new GSize(20, 23);
baseIcon.shadowSize = new GSize(0,0);
baseIcon.iconAnchor = new GPoint(6, 6);
Icon = new GIcon(baseIcon, '/images/house_marker.png');
HouseIcon = new GIcon(baseIcon, '/images/blue_marker.png', null, '/
images/shadow-icon.png');
// Create the marker and corresponding information window
function createInfoMarker(point, address) {
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function()
{ marker.openInfoWindowHtml(address); });
return marker;
}
function createFeatureMarker(point, address) {
var marker = new GMarker(point, { icon: HouseIcon });
GEvent.addListener(marker, "click", function()
{ marker.openInfoWindowHtml(address); });
return marker;
}
<?php mysql_select_db('josegoes');
$qessx = mysql_query("SELECT DISTINCT * FROM ex_data WHERE city =
'$city' GROUP BY street ORDER BY title LIMIT $set_limit, $limit");
$thenumber = 1;
while($row = mysql_fetch_array($qessx))
{
?>
var point = new GPoint(<?=$row['longitude'];?>, <?=$row['latitude'];?
>);
address = "<span class='googtitle'><? echo $thenumber; ?>. <?=
$row['title'];?></span><br /><span class='googphone'><?=$row['phone'];?
></span><br /><span class='googaddre'><?=$row['street'];?></span><br /
><span class='googaddre'><?=$row['city'];?>, <?=$row['state'];?> <?=
$row['zipcode'];?></span>";
var marker = createInfoMarker(point, address);
map.addOverlay(marker);
<?php $thenumber++; }
?>
<?php mysql_select_db('edirectory_dfwdine');
$region = $region_id;
$listy = mysql_query("SELECT * FROM Listing WHERE region_id =
'$region'");
while($rowa = mysql_fetch_array($listy))
{
?>
var point = new GPoint(<?=$rowa['longitude'];?>, <?=$rowa['latitude'];?
>);
address = "<span class='googtitle'><?=$rowa['title'];?></span><br /
><span class='googphone'><?=$rowa['phone'];?></span><br /><span
class='googaddre'><?=$rowa['address'];?> <?=$rowa['address2'];?></
span><br /><span class='googaddre'><?=$city;?>, <?=$state;?> <?=
$rowa['zip_code'];?></span>";
var marker = createFeatureMarker(point, address);
map.addOverlay(marker);
<?php } ?>
//]]>
</script>
<?php
/
****************************************MAP******************************************/
and here's the code to the list of listings. also pulled from a db.
please take a look and tell me how i can do this. I don't know
javascript so please be very specific if you can thank you.
/*************** PHP code pulling listings *********************/
echo "<table width='100%' cellspacing='0'>";
$i = 0;
while($rows = mysql_fetch_array($xerr))
{
if($i%2 == 0)
{
echo "<tr bgcolor='#000000'><td >";
echo "<span class='title'>" . ($i+1) . ". " . $rows['title'] . "</
span>";
echo "</td><td width='150'>";
echo "<span class='phone'>" . $rows['phone'] . "</span>";
echo "</td></tr><tr bgcolor='#000000'><td colspan='2'>";
echo "<span class='addre'>" . $rows['street'] . "</span>";
echo "</td></tr><tr bgcolor='#000000'><td colspan='2'>";
echo "<span class='addre'>" . $rows['city'] .", ". $rows['state'] .".
". $rows['zip'] . "</span>";
echo "<!-- BLANK SPACE --><tr><td colspan='2'><br /></td></tr><!--
BLANK SPACE -->";
$i++;
}else{
echo "<tr bgcolor='#272727'><td >";
echo "<span class='title'>" . ($i+1) . ". " . $rows['title'] . "</
span>";
echo "</td><td width='150'>";
echo "<span class='phone'>" . $rows['phone'] . "</span>";
echo "</td></tr><tr bgcolor='#272727'><td colspan='2'>";
echo "<span class='addre'>" . $rows['street'] . "</span>";
echo "</td></tr><tr bgcolor='#272727'><td colspan='2'>";
echo "<span class='addre'>" . $rows['city'] .", ". $rows['state'] .".
". $rows['zip'] . "</span>";
echo "<!-- BLANK SPACE --><tr><td colspan='2'><br /></td></tr><!--
BLANK SPACE -->";
$i++;
}
}
echo "</table>";
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---