Source: site.view [edit]
Function name: yahooLocal
Arguments: search,location
Description: Looks up records that match search at location 'place', using Yahoo Local
Page type: webl
Render function:   tableRender
Module: global

Page source:

var q = Url_Encode("select * from local.search where location='" + location + "' and query='" + search + "'");
var url = "http://query.yahooapis.com/v1/public/yql?q=" + q;

var P = GetURL(url);

var res = [];

var TextVal = fun(P, fieldname, elt)
   var E = Elem(P, fieldname) inside elt; 
   return (Str_Trim(Text(E[0])) ? "")
end;

var ListVal = fun(P, fieldname, elt)
   var E = Elem(P, fieldname) inside elt; 
   res = "";
   every child in Children(E[0]) do
      if (res != "") then
         res = res + ","
      end;
      res = res + Str_Trim(Text(child));
   end;
   return res
end;

every r in Elem(P, "Result") do
   res = res + [ [.
      title=TextVal(P, "Title", r),
      address=TextVal(P, "Address", r),
      city=TextVal(P, "City", r),
      state=TextVal(P, "State", r),
      phone=TextVal(P, "Phone", r),
      category=TextVal(P, "Category", r),
      categories=ListVal(P, "Categories", r),
      latitude=TextVal(P, "Latitude", r),
      longitude=TextVal(P, "Longitude", r),
      rating=TextVal(P, "Rating", r),
      averagerating=TextVal(P, "AverageRating", r),
      totalratings=TextVal(P, "TotalRatings", r),
      totalreviews=TextVal(P, "TotalReviews", r),
      distance=TextVal(P, "Distance", r),
      url=TextVal(P, "Url", r),
      mapurl=TextVal(P, "MapUrl", r),
      businessurl=TextVal(P, "BusinessUrl", r),
      desc=TextVal(P, "Address", r)+"<br>"+TextVal(P, "Phone", r)+"&nbsp;&nbsp;"+
         `<a target="_blank" href='` + TextVal(P, "Url", r)+`'>Details</a>`,
      html = Pretty(r)
    .] ];
end;

[. title="Results for " + search + " near " + location,
   items=res,
   zoomLevel = "5",
   width = 700,
   height = 500, 
   showIndex = "true"
.];