Disregard my previous email....I do know that function..obviously!!! lol
function searchLocationsNear(center) {
var radius = document.getElementById('radiusSelect').value;
var searchUrl = 'phpsqlsearch_genxml.php?lat=' + center.lat() + '&lng='
+ center.lng() + '&radius=' + radius;
//var searchUrl = '
http://localhost/store_locater/phpsqlsearch_genxml.php?lat=40.146673&lng=-86.503885&radius=200
';
GDownloadUrl(searchUrl, function(data) {
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName('marker');
map.clearOverlays();
var sidebar = document.getElementById('sidebar');
sidebar.innerHTML = '';
if (markers.length == 0) {
sidebar.innerHTML = 'No results found.';
map.setCenter(new GLatLng(40, -86), 4);
return;
}
I put fake Lat/Lngs in there....anyway, it's possible your function got
messed up while you were trying to debug all the varying factors. Try
something based on the above. It's straight Google API stuff v2
On Thu, Apr 8, 2010 at 9:33 PM, Karen Windus <[email protected]> wrote:
> Oh and I haven't played around with the searchLocationsNear function
> yet...but would love to hear more about what you're trying to do with it. I
> would imagine it's a matter of passing a geocode or a Lat/Lng into it with a
> parameter of some sort to define the "Near" part, no?
>
>
> On Thu, Apr 8, 2010 at 9:05 PM, Eric <[email protected]> wrote:
>
>> !!!!! FINALLY!
>>
>> Thank you Karen! You set me in the right direction. I also added
>> "id" into the $query = sprintf line on the genxml.php page and added a
>> $newnode at the bottom. It's working.
>>
>>
>>
>> That leaves me with 3 more questions still:
>>
>> First, on the results page it is zooming to the correct location but
>> not adding a marker... This is the only one that I am super concerned
>> about.
>>
>> Second, I have a filter on the search that I would like to
>> incorporate. I need to run an if statement on the results and only
>> display certain ones. I have fields in my table for these locations
>> and the values are either y or n to indicate if they fall into that
>> category (some fall into multiple categories).
>>
>> Finally, I would like the option to have "featured" locations and I
>> would like them to appear first, so if the searchLocationsNear
>> function could separate those out first, then display the rest, that
>> would be great. I have another field with a y or n value to determine
>> if the location is featured or not.
>>
>> On Apr 8, 10:32 pm, Eric <[email protected]> wrote:
>> > Thanks for the response... However, now the search does not work...
>> > I've triple checked the code and everything seems to be in place, it
>> > just doesn't return any results (it doesn't even return a "no results
>> > found"... Is there anything I need to change in the genxml.php file?
>> > I tried adding a $newnode for id but nothing seems to help...
>> >
>> > On Apr 8, 11:31 am, Karen Windus <[email protected]> wrote:
>> >
>> >
>> >
>> > > This is how I did it for some basic info with a link that I built from
>> my
>> > > XML file...granted, this was built just before the release of v3 API,
>> but
>> > > I'm thinking that it should still work. If it doesn't, let me know.
>> It
>> > > would be nice to know what I need to do to upgrade parts of my code
>> from 2.5
>> > > to 3.0...
>> >
>> > > var marker = createMarker(point, name, address, city, state, zip,
>> rooms,
>> > > id);
>> > > //alert(markers.length);
>> > > map.addOverlay(marker);
>> > > var sidebarEntry = createSidebarEntry(marker, name, address,
>> city,
>> > > state, zip, rooms, distance);
>> > > sidebar.appendChild(sidebarEntry);
>> > > bounds.extend(point);
>> > > }
>> > > map.setCenter(bounds.getCenter(),
>> map.getBoundsZoomLevel(bounds));
>> > > });
>> > > }
>> >
>> > > function createMarker(point, name, address, city, state, zip,
>> rooms, id)
>> > > {
>> > > var marker = new GMarker(point);
>> > > var html = '<b>' + name + '</b> <br/>' + address + '<br/>' +
>> city +
>> > > ', ' + state + ', ' + zip + '<br/><b><font
>> > > color="red">Number of rooms:</font> ' + beds + '</b><br/><a
>> > > href=localhost/member.php?id=' + id + '>Profile</a>';
>> > > GEvent.addListener(marker, 'click', function() {
>> > > marker.openInfoWindowHtml(html);
>> > > });
>> > > return marker;
>> > > }
>> >
>> > > That should be the code to answer your question I hope. If not or if
>> I
>> > > misread your question let me know...
>> >
>> > > Best of luck,
>> >
>> > > Karen
>> >
>> > > On Thu, Apr 8, 2010 at 9:21 AM, Eric <[email protected]> wrote:
>> > > > My test site is
>> > > >http://www.byebyewithbaby.com/test3.php. I have searched but haven't
>> > > > found any answers on this...
>> >
>> > > > I used the tutorial at
>> > > >http://code.google.com/apis/maps/articles/phpsqlsearch_v3.html
>> > > > for the code to this search.
>> >
>> > > > I have a page (http://www.byebyewithbaby.com/locations.php) that,
>> > > > when
>> > > > passed a "location_number" (ie locations.php?&location_number=[id
>> > > > goes
>> > > > here]) it will dynamically display more details on the entry for
>> that
>> > > > particular id number (which is in $row[0]).
>> >
>> > > > What code would I enter (and where would I enter it - I'm assuming
>> in
>> > > > the "function createMarker" area) to have it display a
>> > > > link of "<a href='http://www.byebyewithbaby.com/locations.php?
>> > > > &location_number=".$row[0]."'>Click Here for More Info</a>"?
>> >
>> > > > --
>> > > > You received this message because you are subscribed to the Google
>> Groups
>> > > > "Google Maps JavaScript API v3" group.
>> > > > To post to this group, send email to
>> > > > [email protected].
>> > > > To unsubscribe from this group, send email to
>> > > > [email protected]<google-maps-js-api-v3%[email protected]><google-maps-js-api-v3%2B
>> [email protected]>
>> > > > .
>> > > > For more options, visit this group at
>> > > >http://groups.google.com/group/google-maps-js-api-v3?hl=en.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Maps JavaScript API v3" group.
>> To post to this group, send email to
>> [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<google-maps-js-api-v3%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-maps-js-api-v3?hl=en.
>>
>>
>
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.