"; $sidebar=""; $lettercounter="1"; $openfunctions=""; $mapfunction=""; $columncounter=0; $mapfunction.=""; # now that we know how many photos, we need to initialize our arrays. We need the following: # 0) an array containing all our keywords $allkeywords = array("durham","hwy54and55","duke","miamidrive","fayettevilleroad","woodcroft","raleigh","briercreek","morrisville","airportroad","hwy54east","davisdrive","buffet","cafeteriastyle","counterservice","tableservice","drivethru","breakfast","dinner","latelunch","lunch","weekend","african","asian","chinese","japanese","korean","thai","vietnamese","caribbean","jamaican","indian","mediterranean","italian","latinamerican","cuban","mexican","bbq","coffee","pizza","salads","sandwiches","soup","platelunch","vegetarian"); # php array iteration: foreach ($allkeywords as $thiskeyword) { ${$thiskeyword}=array(); # 2) a prefilled array with $numphotos+1 elements called $numctr=0; while($numctr<=$numphotos){ ${$thiskeyword}[$numctr]=0; $numctr++; }; }; $allon = array(); $alloff = array(); $numctr2=0; while($numctr2<=$numphotos){ $allon[$numctr2]=1; $alloff[$numctr2]=0; $numctr2++; }; $photoids = array(); $photo_latitude = array(); $photo_longitude = array(); $photo_latitude[0]=0; $photo_longitude[0]=0; $counter=0; $photoids[0]=0; $doovers = 0; while ($rsp_obj{$keeper}["photos"]["photo"][$counter]["id"]!=""){ $photoID = $rsp_obj{$keeper}["photos"]["photo"][$counter]["id"]; $secret=$rsp_obj{$keeper}["photos"]["photo"][$counter]["secret"]; $server=$rsp_obj{$keeper}["photos"]["photo"][$counter]["server"]; $farm=$rsp_obj{$keeper}["photos"]["photo"][$counter]["farm"]; $name=$rsp_obj{$keeper}["photos"]["photo"][$counter]["title"]; $namefixed=str_replace("'","\\'",$name); $namefixed=str_replace("&","\\&",$namefixed); $thumb_url="http://farm".$farm.".static.flickr.com/".$server."/".$photoID."_".$secret."_s.jpg"; $counter++; $photoids[$counter]=$photoID; $params = array( 'api_key' => 'insertyourflickrapikeyhere', 'method' => 'flickr.photos.getInfo', 'secret' => $secret, 'photo_id' => $photoID, 'format' => 'php_serial', ); $encoded_params = array(); foreach ($params as $k => $v){ $encoded_params[] = urlencode($k).'='.urlencode($v); }; $url2 = "http://api.flickr.com/services/rest/?".implode('&', $encoded_params); $rsp2 = file_get_contents($url2); $rsp_obj2 = unserialize($rsp2); # that will provide the tags, the location data, the description, and anything else I want in the following array structure (includes xample data): #[photo] => # [description][_content] # [tags][tag] => # [$counter] # [id] => 4161208-216243696-4941868 # [author] => 75257552@N00 # [raw] => rtplunch # [_content] => rtplunch # [location] => # [latitude] => 36.006843 # [longitude] => -78.947882 # [accuracy] => 16 # [urls][url] => # [$counter] # [type] => photopage # [_content] => http://www.flickr.com/photos/rtplunch/216243696/ if ($rsp_obj2['stat'] == 'ok'){ $URL=$rsp_obj2["photo"]["urls"]["url"][0]["_content"]; $description=$rsp_obj2["photo"]["description"]["_content"]; $photo_latitude[$counter] = $rsp_obj2['photo']['location']['latitude']; $photo_longitude[$counter] = $rsp_obj2['photo']['location']['longitude']; $photo_accuracy = $rsp_obj2['photo']['location']['accuracy']; $tagcounter=0; while ($rsp_obj2["photo"]["tags"]["tag"][$tagcounter]["id"]!=""){ # here's where we step through the tags & fill our 2 arrays per tag . . . $thistag=$rsp_obj2["photo"]["tags"]["tag"][$tagcounter]["_content"]; #some tags aren't in our tag array; we want to ignore them: if(array_search($thistag,$allkeywords)===FALSE){ #do nothing }else{ #flip this restaurant's number to "on" for this tag: ${$thistag}[$lettercounter]=1; }; $tagcounter++; }; $descparts=explode("\n",$description); $partcounter=0; $address=""; $phone=""; $hours=""; $website=""; while($descparts[$partcounter]){ if (strstr($descparts[$partcounter], "Address: ")){ $address=strstr($descparts[$partcounter], "Address: "); }elseif(strstr($descparts[$partcounter], "Phone: ")){ $phone=strstr($descparts[$partcounter], "Phone: "); }elseif(strstr($descparts[$partcounter], "Hours: ")){ $hours=strstr($descparts[$partcounter], "Hours: "); }elseif(strstr($descparts[$partcounter], "Website: ")){ #this needs work, plus lower down where $URL appears, need to add target="_blank" $website=strstr($descparts[$partcounter], "Website: "); }; $partcounter++; }; }else{ $url2 = "http://api.flickr.com/services/rest/?".implode('&', $encoded_params); $rsp2 = file_get_contents($url2); $rsp_obj2 = unserialize($rsp2); # that will provide the tags, the location data, the description, and anything else I want in the following array structure (incl. xample data): #[photo] => # [description][_content] # [tags][tag] => # [$counter] # [id] => 4161208-216243696-4941868 # [author] => 75257552@N00 # [raw] => rtplunch # [_content] => rtplunch # [location] => # [latitude] => 36.006843 # [longitude] => -78.947882 # [accuracy] => 16 # [urls][url] => # [$counter] # [type] => photopage # [_content] => http://www.flickr.com/photos/rtplunch/216243696/ if ($rsp_obj2['stat'] == 'ok'){ $URL=$rsp_obj2["photo"]["urls"]["url"][0]["_content"]; $description=$rsp_obj2["photo"]["description"]["_content"]; $photo_latitude[$counter] = $rsp_obj2['photo']['location']['latitude']; $photo_longitude[$counter] = $rsp_obj2['photo']['location']['longitude']; $photo_accuracy = $rsp_obj2['photo']['location']['accuracy']; $tagcounter=0; while ($rsp_obj2["photo"]["tags"]["tag"][$tagcounter]["id"]!=""){ # here's where we step through the tags & fill our 2 arrays per tag . . . $thistag=$rsp_obj2["photo"]["tags"]["tag"][$tagcounter]["_content"]; #some tags aren't in our tag array; we want to ignore them: if(array_search($thistag,$allkeywords)===FALSE){ #do nothing }else{ #flip this restaurant's number to "on" for this tag: ${$thistag}[$lettercounter]=1; }; $tagcounter++; }; $descparts=explode("\n",$description); $partcounter=0; while($descparts[$partcounter]){ if (strstr($descparts[$partcounter], "Address: ")){ $address=strstr($descparts[$partcounter], "Address: "); }elseif(strstr($descparts[$partcounter], "Phone: ")){ $phone=strstr($descparts[$partcounter], "Phone: "); }elseif(strstr($descparts[$partcounter], "Hours: ")){ $hours=strstr($descparts[$partcounter], "Hours: "); }elseif(strstr($descparts[$partcounter], "Website: ")){ #this needs work, plus lower down where $URL appears, need to add target="_blank" $website=strstr($descparts[$partcounter], "Website: "); }; $partcounter++; }; }; }; $sidebar.="
".$name."
"; $columncounter++; $mapfunction.= "point".$lettercounter." = new GPoint(".$photo_longitude[$lettercounter].",".$photo_latitude[$lettercounter].");\n"; $mapfunction.= "icon".$lettercounter." = new GIcon(baseIcon);\n"; $mapfunction.= "icon".$lettercounter.".image = \"http://www.rtplunch.com/markers/marker".$lettercounter.".png\"\n"; $mapfunction.= "marker".$lettercounter." = new GMarker(point".$lettercounter.",icon".$lettercounter.");\n"; $mapfunction.="gmarkers[".$lettercounter."]=marker".$lettercounter.";\n"; // removed the addOverlay here, to start with a blank slate: // $mapfunction.= "map.addOverlay(marker".$lettercounter.");\n"; $mapfunction.= "GEvent.addListener(marker".$lettercounter.", \"click\", function() {\n"; $mapfunction.= "opener".$lettercounter."()\n"; $mapfunction.= "});\n"; $openfunctions.= "function opener".$lettercounter."(which) {\n"; $openfunctions.="map.closeInfoWindow();\n"; $htmlstub = "'

".$namefixed." (more info)

".$address."

".$phone."

".$hours."

"; $htmlstub .= "
"; $htmlstub .= "Directions: '"; $openfunctions.= "var html=".$htmlstub."\n"; $openfunctions.= "if (which == 'to')\n html += 'To here - ';\n else \n html += 'To here - ';\n"; $openfunctions.= "if (which == 'from') \n html += 'From here
';\n else \n html += 'From here
';\n"; $openfunctions.= "if (which) { \n var hName = ''; \n var vName = ''; \n if (which == 'to') { \n"; $openfunctions.= " html += 'Start address:
'; \n hName = \"daddr\"; \n vName = \"saddr\"; \n } \n else { \n"; $openfunctions.=" html += 'End address:
'; \n hName = \"saddr\"; \n vName = \"daddr\"; }\n"; $openfunctions.= "html += '
';\n"; $openfunctions.= " }\n"; $openfunctions.= "\n map.setCenter(new GLatLng(".$photo_latitude[$lettercounter].",".$photo_longitude[$lettercounter]."),15);\n"; $openfunctions.= "if (which) \n marker".$lettercounter.".openInfoWindowHtml('
' + html + '
');\n"; $openfunctions.= "else \n marker".$lettercounter.".openInfoWindowHtml('
' + html + '
');\n"; // removing the recenter-on-close listener: // $openfunctions.= "GEvent.addListener(marker".$lettercounter.", \"infowindowclose\", function() {\n map.setCenter(new GLatLng(35.89,-78.86), 12);\n });\n"; $openfunctions.= "};\n"; $lettercounter++; }; $mapfunction.= "var searchString = document.location.search;\n"; $mapfunction.="searchString = searchString.substring(1);\n"; $mapfunction.="var nvPairs = searchString.split(\"&\");\n"; $mapfunction.="outerLoop:\n"; $mapfunction.="for (i = 0; i < nvPairs.length; i++)\n"; $mapfunction.="{\n var nvPair = nvPairs[i].split(\"=\");\n"; $mapfunction.=" if(nvPair[0]==\"photoid\"){\n"; $mapfunction.=" for(j=0; j<=numphotos; j++){\n"; $mapfunction.=" if(nvPair[1]==photoids[j]){\n"; $mapfunction.=" var thisopener=\"opener\"+j;\n"; $mapfunction.=" document.getElementById(j).style.display = 'block';\n"; $mapfunction.=" map.addOverlay(gmarkers[j]);\n"; $mapfunction.=" myGlobal[thisopener]();\n"; $mapfunction.=" continue outerLoop;\n"; $mapfunction.=" }\n }\n }\n"; $mapfunction.="}\n\n"; $mapfunction.="\n} \n ".$openfunctions." } \n \n "; $mapfunction.="//]]> \n \n "; echo $markervars; ?>
RTPLunch.com is a flickr/googlemaps mashup with the specific goal of making it easier to decide where to go to lunch. Click keywords at the bottom to filter the list of restaurants. Click restaurant names to view them on the map, get more info, link to their websites, and get directions. If you'd like to contribute to the project or just learn more, visit the rtplunch group at flickr. (click to close)
To begin, click one or more keywords in the list below, and a list of restaurants matching those keywords will appear here. For more info on how to filter, click "how to filter" below.
  • durham
  • hwy54and55
  • duke
  • miamidrive
  • fayettevilleroad
  • woodcroft
  • raleigh
  • briercreek
  • morrisville
  • airportroad
  • hwy54east
  • davisdrive
  • buffet
  • cafeteriastyle
  • counterservice
  • tableservice
  • drivethru
  • breakfast
  • lunch
  • latelunch
  • dinner
  • weekend
  • bbq
  • coffee
  • pizza
  • platelunch
  • salads
  • sandwiches
  • soup
  • vegetarian
  • african
  • asian
  • chinese
  • japanese
  • korean
  • thai
  • vietnamese
  • caribbean
  • jamaican
  • indian
  • latinamerican
  • cuban
  • mexican
  • mediterranean
  • italian

how to filter

Click a keyword to add it to the filter box. By default, keywords in the box are OR filters: "chinese mexican" would get you all restaurants with either "chinese" or "mexican" in their keyword lists.

Click once on a filter already in the box to put a "+" in front of it. This turns it into an AND filter: "+chinese +mexican" would get you any restaurants with both "chinese" and "mexican" in their keyword lists.

Click twice on a filter in the box to put a "-" in front of it. This turns it into a NOT filter: "-chinese" would get you all restaurants that do not have "chinese" in their keyword lists.

Click again on the keyword in the keyword list to remove it from the filter box. You can have a total of five filters active at once.

When different filters are combined, the NOT filters are applied first, then the AND filters, and last the OR filters: "chinese mexican +latelunch -tableservice" would get you restaurants which do NOT have table service, which are open after 2:00 p.m., and which serve either chinese or mexican food.