SlideShare a Scribd company logo
YQL & YUI
    JavaScript from the server to the user




Tom
Hughes-Croucher
YQL & YUI
    JavaScript from the server to the user
        or how
                  to talk
                          like a
                                 Pirate

Tom
Hughes-Croucher
YQL and YUI - Javascript from server to user
“Talk Like A Pirate Day”

• September 19 (Saturday)
• It be a special day when yonder landlubbers
  learn to like ye noblest of all thar sea faring
  folk, Pirates!
Demo time
http://developer.yahoo.com/yql/console/?env=store://
               kid666.com/piratespeak
How would I use this
  pirate power?
              Piratize Bookmarklet
    javascript:(function(){head=document.getElementsByTagName(%22head%22)
       [0];script=document.createElement(%22script%22);script.src=%22http://
         l.yimg.com/d/lib/ydn/js/pirate1252961643.js%22;script.type=%22text/
                      javascript%22;head.appendChild(script);})();
YQL and YUI - Javascript from server to user
dev
dev
dev
dev
dev
dev
dev
dev
dev
dev
dev
var map = new
      YMap(document.getElementById('map'));
      …
dev   var currentGeoPoint = new
      YGeoPoint( _c.Lat, _c.Lon );
      map.addMarker(currentGeoPoint);
      …
var map = new
      YMap(document.getElementById('map'));
      …
dev   var currentGeoPoint = new
      YGeoPoint( _c.Lat, _c.Lon );
      map.addMarker(currentGeoPoint);
      …



      …
      if (flickcurl_prepare(fc,
      "flickr.photos.geo.correctLocation",
      parameters, count)) { … }
      …
var map = new
      YMap(document.getElementById('map'));
      …
dev   var currentGeoPoint = new
      YGeoPoint( _c.Lat, _c.Lon );
      map.addMarker(currentGeoPoint);
      …



      …
      if (flickcurl_prepare(fc,
      "flickr.photos.geo.correctLocation",
      parameters, count)) { … }
      …



      http://search.yahooapis.com/
      ImageSearchService/V1/imageSearch?
      appid=YahooDemo&query=Corvette&results=2
var map = new
      YMap(document.getElementById('map'));
      …
dev   var currentGeoPoint = new
      YGeoPoint( _c.Lat, _c.Lon );
      map.addMarker(currentGeoPoint);
      …



      …
      if (flickcurl_prepare(fc,
      "flickr.photos.geo.correctLocation",
      parameters, count)) { … }
      …



      http://search.yahooapis.com/
      ImageSearchService/V1/imageSearch?
      appid=YahooDemo&query=Corvette&results=2




      http://weather.yahooapis.com/
      forecastrss?p=FRXX0076&u=c
var map = new
      YMap(document.getElementById('map'));
      …
dev   var currentGeoPoint = new
      YGeoPoint( _c.Lat, _c.Lon );
      map.addMarker(currentGeoPoint);
      …



      …
      if (flickcurl_prepare(fc,
      "flickr.photos.geo.correctLocation",
      parameters, count)) { … }
      …



      http://search.yahooapis.com/
      ImageSearchService/V1/imageSearch?
      appid=YahooDemo&query=Corvette&results=2




      http://weather.yahooapis.com/
      forecastrss?p=FRXX0076&u=c
var map = new
      YMap(document.getElementById('map'));
      …
dev   var currentGeoPoint = new
      YGeoPoint( _c.Lat, _c.Lon );
      map.addMarker(currentGeoPoint);
      …



      …
      if (flickcurl_prepare(fc,
      "flickr.photos.geo.correctLocation",
      parameters, count)) { … }
      …



      http://search.yahooapis.com/
      ImageSearchService/V1/imageSearch?
      appid=YahooDemo&query=Corvette&results=2




      http://weather.yahooapis.com/
      forecastrss?p=FRXX0076&u=c
var map = new
      YMap(document.getElementById('map'));
      …
dev   var currentGeoPoint = new
      YGeoPoint( _c.Lat, _c.Lon );
      map.addMarker(currentGeoPoint);
      …



      …
      if (flickcurl_prepare(fc,
      "flickr.photos.geo.correctLocation",
      parameters, count)) { … }
      …



      http://search.yahooapis.com/
      ImageSearchService/V1/imageSearch?
      appid=YahooDemo&query=Corvette&results=2




      http://weather.yahooapis.com/
      forecastrss?p=FRXX0076&u=c
var map = new
      YMap(document.getElementById('map'));
      …
dev   var currentGeoPoint = new
      YGeoPoint( _c.Lat, _c.Lon );
      map.addMarker(currentGeoPoint);
      …



      …
      if (flickcurl_prepare(fc,
      "flickr.photos.geo.correctLocation",
      parameters, count)) { … }
      …



      http://search.yahooapis.com/
      ImageSearchService/V1/imageSearch?
      appid=YahooDemo&query=Corvette&results=2




      http://weather.yahooapis.com/
      forecastrss?p=FRXX0076&u=c
var map = new
          YMap(document.getElementById('map'));
          …
dev       var currentGeoPoint = new
          YGeoPoint( _c.Lat, _c.Lon );
          map.addMarker(currentGeoPoint);


      ?
          …



          …
          if (flickcurl_prepare(fc,


      ?
          "flickr.photos.geo.correctLocation",
          parameters, count)) { … }
          …



      ?   http://search.yahooapis.com/
          ImageSearchService/V1/imageSearch?
          appid=YahooDemo&query=Corvette&results=2


      ?
          http://weather.yahooapis.com/
          forecastrss?p=FRXX0076&u=c
var map = new
          YMap(document.getElementById('map'));
          …
dev       var currentGeoPoint = new
          YGeoPoint( _c.Lat, _c.Lon );
          map.addMarker(currentGeoPoint);


      ?
          …



          …
          if (flickcurl_prepare(fc,


      ?
          "flickr.photos.geo.correctLocation",
          parameters, count)) { … }
          …



      ?   http://search.yahooapis.com/
          ImageSearchService/V1/imageSearch?
          appid=YahooDemo&query=Corvette&results=2


      ?
          http://weather.yahooapis.com/
          forecastrss?p=FRXX0076&u=c
var map = new
      YMap(document.getElementById('map'));
      …
dev   var currentGeoPoint = new
      YGeoPoint( _c.Lat, _c.Lon );
      map.addMarker(currentGeoPoint);
      …



      …
      if (flickcurl_prepare(fc,
      "flickr.photos.geo.correctLocation",
      parameters, count)) { … }
      …



      http://search.yahooapis.com/
      ImageSearchService/V1/imageSearch?
      appid=YahooDemo&query=Corvette&results=2




      http://weather.yahooapis.com/
      forecastrss?p=FRXX0076&u=c
dev




      YQL
dev




      YQL
dev



       Bindings




      YQL
YQL in Practice
20 tiny steps to a working application

             You’ll need:
               Firefox
               Firebug
             Text editor
Step 1.
Login to the console with your Yahoo! login
  http://developer.yahoo.com/yql/console
Step 2.
 Find the statement box and
run the first query with test.
Step 3.
Check out the formatted view.
Step 4.
Run the statement “desc html”
Step 5.
    Find the keys,
note the required keys.
Step 6.
               Get some HTML:
  select * from html where url = "http://
hubblesite.org/gallery/album/the_universe"
Step 7.
 Check out the result.
See the HTML in there?
Step 8.
Open http://hubblesite.org/gallery/album/the_universe
                      in Firefox.
Right click on a thumbnail and click “Inspect Element”
Step 9.
    Find the element in Firebug.
Right click and select “Copy XPath”
Step 10.
Add and xpath = "" to your query.
  Paste in the XPath from Firebug
Step 11.
Test your statement and
   refine your XPath.
Step 12.
Add limit 10 to your statement
Step 13.
      Let’s get out of the console.
Copy the “Rest Query” url into a new tab
Step 14.
        Let’s embed this in a web page.
            Download the files from
http://github.com/sh1mmer/dotnet-yql-tutorial
Step 15.
               Add
  <script type="text/javascript"
src="yql_js_widget.js"></script>
        to your HTML page.
Step 16.
                        Add some style:
<style type="text/css">
li.imgCnt{ list-style: none; background:#000000; margin: 3px; float:
left; }
li.imgCnt img{ border:0; margin:5px; }
li.imgCnt div.imgTitle{ padding: 5px; font-size: 11px; text-
align:center; }
</style>
Step 17.
Add another script node.
   Add config = {};
Step 18.
         Format the output:
var format = '<li class="imgCnt">
<img src="{src}" alt="{alt}"></li>';
Step 19.
          Add you query;
var yqlQuery = "" and add your query.
Step 20.
Add the render code:

yqlWidget.push(yqlQuery,config,format,'widge
tContainer');
yqlWidget.render();
Fin.
Tom Hughes-Croucher
          @sh1mmer
    croucher@yahoo-inc.com

More Related Content

KEY
YQL Tutorial
PDF
Mobile Data: How to avoid the latency trap - SWDC 2010
PDF
openFrameworks – パーティクルを動かす、静的配列と動的配列 - 多摩美メディアアートII
PDF
PDF
openFrameworks – 関数・クラス、オブジェクト指向プログラミング導入 - 多摩美メディアアートII
PDF
Sbaw091020
PDF
Shift Remote FRONTEND: Reactivity in Vue.JS 3 - Marko Boskovic (Barrage)
KEY
Sbaw090519
YQL Tutorial
Mobile Data: How to avoid the latency trap - SWDC 2010
openFrameworks – パーティクルを動かす、静的配列と動的配列 - 多摩美メディアアートII
openFrameworks – 関数・クラス、オブジェクト指向プログラミング導入 - 多摩美メディアアートII
Sbaw091020
Shift Remote FRONTEND: Reactivity in Vue.JS 3 - Marko Boskovic (Barrage)
Sbaw090519

What's hot (10)

PDF
Java programs
PPT
Tilting Google Maps and MissileLauncher
PDF
JavaScript Event Loop
PDF
Basic program in java
DOCX
C program to implement linked list using array abstract data type
DOCX
Calculator code with scientific functions in java
DOC
Final ds record
DOCX
Pratik Bakane C++
TXT
Ştiri de ultima ora si ultimele ştiri Vdtonline.com
Java programs
Tilting Google Maps and MissileLauncher
JavaScript Event Loop
Basic program in java
C program to implement linked list using array abstract data type
Calculator code with scientific functions in java
Final ds record
Pratik Bakane C++
Ştiri de ultima ora si ultimele ştiri Vdtonline.com
Ad

Viewers also liked (6)

KEY
Innovateeurope
PDF
Server Side JavaScript - You ain't seen nothing yet
KEY
Let's run JavaScript Everywhere
ZIP
Accessibililty 101
KEY
Mobile And The Latency Trap
PDF
Doing Horrible Things to DNS in the Name of Science - SF Performance Meetup
Innovateeurope
Server Side JavaScript - You ain't seen nothing yet
Let's run JavaScript Everywhere
Accessibililty 101
Mobile And The Latency Trap
Doing Horrible Things to DNS in the Name of Science - SF Performance Meetup
Ad

Similar to YQL and YUI - Javascript from server to user (20)

KEY
Seti 09
PDF
Intro to HTML5
PDF
Webgl para JavaScripters
PPTX
Yahoo Query Language: Select * from Internet
PDF
HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07
PDF
PDF
YQL: Select * from internet - Campus Party 2010
ODP
Non Conventional Android Programming En
ODP
Non Conventional Android Programming (English)
PDF
Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09
PDF
Cross Domain Web
Mashups with JQuery and Google App Engine
PPTX
Fact, Fiction, and FP
PDF
“SELECT * FROM internet;” como usar o YQL com Yahoo! Meme e outros serviços
PDF
HTML for the Mobile Web, Firefox OS - All Things Open - 2014-10-22
PDF
HTML, not just for desktops: Firefox OS - Congreso Universitario Móvil - 201...
KEY
Leaving Flatland: getting started with WebGL
PDF
H3 경쟁력있는 웹앱 개발을 위한 모바일 js 프레임웍
ZIP
YQL Open Hackday NYC talk
ZIP
YQL - select * from internet version 2
PDF
Five things for you - Yahoo developer offers
Seti 09
Intro to HTML5
Webgl para JavaScripters
Yahoo Query Language: Select * from Internet
HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07
YQL: Select * from internet - Campus Party 2010
Non Conventional Android Programming En
Non Conventional Android Programming (English)
Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09
Cross Domain Web
Mashups with JQuery and Google App Engine
Fact, Fiction, and FP
“SELECT * FROM internet;” como usar o YQL com Yahoo! Meme e outros serviços
HTML for the Mobile Web, Firefox OS - All Things Open - 2014-10-22
HTML, not just for desktops: Firefox OS - Congreso Universitario Móvil - 201...
Leaving Flatland: getting started with WebGL
H3 경쟁력있는 웹앱 개발을 위한 모바일 js 프레임웍
YQL Open Hackday NYC talk
YQL - select * from internet version 2
Five things for you - Yahoo developer offers

More from Tom Croucher (20)

PDF
Using Node.js to Build Great Streaming Services - HTML5 Dev Conf
KEY
Streams are Awesome - (Node.js) TimesOpen Sep 2012
KEY
Using Node.js to improve the performance of Mobile apps and Mobile web
KEY
Writing robust Node.js applications
KEY
Creating the Internet of Things with JavaScript - Fluent Conf
KEY
Using Node.js to make HTML5 work for everyone
KEY
A million connections and beyond - Node.js at scale
KEY
OSCON 2011 - Node.js Tutorial
PDF
Lessons from a coding veteran - Web Directions @Media
KEY
Multi-tiered Node Architectures - JSConf 2011
KEY
A language for the Internet: Why JavaScript and Node.js is right for Internet...
KEY
A language for the Internet: Why JavaScript and Node.js is right for Internet...
PDF
How to stop writing spaghetti code
PDF
Doing Horrible Things with DNS - Web Directions South
PDF
JavaScript is the new black - Why Node.js is going to rock your world - Web 2...
KEY
How to stop writing spaghetti code - JSConf.eu 2010
PDF
Sf perf
PDF
Node.js and How JavaScript is Changing Server Programming
PDF
JavaScript Everywhere! Creating a 100% JavaScript web stack
KEY
Pirate yql
Using Node.js to Build Great Streaming Services - HTML5 Dev Conf
Streams are Awesome - (Node.js) TimesOpen Sep 2012
Using Node.js to improve the performance of Mobile apps and Mobile web
Writing robust Node.js applications
Creating the Internet of Things with JavaScript - Fluent Conf
Using Node.js to make HTML5 work for everyone
A million connections and beyond - Node.js at scale
OSCON 2011 - Node.js Tutorial
Lessons from a coding veteran - Web Directions @Media
Multi-tiered Node Architectures - JSConf 2011
A language for the Internet: Why JavaScript and Node.js is right for Internet...
A language for the Internet: Why JavaScript and Node.js is right for Internet...
How to stop writing spaghetti code
Doing Horrible Things with DNS - Web Directions South
JavaScript is the new black - Why Node.js is going to rock your world - Web 2...
How to stop writing spaghetti code - JSConf.eu 2010
Sf perf
Node.js and How JavaScript is Changing Server Programming
JavaScript Everywhere! Creating a 100% JavaScript web stack
Pirate yql

Recently uploaded (20)

PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
A comparative analysis of optical character recognition models for extracting...
PPTX
A Presentation on Artificial Intelligence
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PPTX
Spectroscopy.pptx food analysis technology
PDF
Electronic commerce courselecture one. Pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Machine Learning_overview_presentation.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Cloud computing and distributed systems.
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPT
Teaching material agriculture food technology
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
cuic standard and advanced reporting.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Encapsulation_ Review paper, used for researhc scholars
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
A comparative analysis of optical character recognition models for extracting...
A Presentation on Artificial Intelligence
NewMind AI Weekly Chronicles - August'25-Week II
Spectroscopy.pptx food analysis technology
Electronic commerce courselecture one. Pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Machine Learning_overview_presentation.pptx
sap open course for s4hana steps from ECC to s4
Cloud computing and distributed systems.
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
The Rise and Fall of 3GPP – Time for a Sabbatical?
Teaching material agriculture food technology
Per capita expenditure prediction using model stacking based on satellite ima...
cuic standard and advanced reporting.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Encapsulation_ Review paper, used for researhc scholars

YQL and YUI - Javascript from server to user

  • 1. YQL & YUI JavaScript from the server to the user Tom Hughes-Croucher
  • 2. YQL & YUI JavaScript from the server to the user or how to talk like a Pirate Tom Hughes-Croucher
  • 4. “Talk Like A Pirate Day” • September 19 (Saturday) • It be a special day when yonder landlubbers learn to like ye noblest of all thar sea faring folk, Pirates!
  • 6. How would I use this pirate power? Piratize Bookmarklet javascript:(function(){head=document.getElementsByTagName(%22head%22) [0];script=document.createElement(%22script%22);script.src=%22http:// l.yimg.com/d/lib/ydn/js/pirate1252961643.js%22;script.type=%22text/ javascript%22;head.appendChild(script);})();
  • 8. dev
  • 9. dev
  • 10. dev
  • 11. dev
  • 12. dev
  • 13. dev
  • 14. dev
  • 15. dev
  • 16. dev
  • 17. dev
  • 18. dev
  • 19. var map = new YMap(document.getElementById('map')); … dev var currentGeoPoint = new YGeoPoint( _c.Lat, _c.Lon ); map.addMarker(currentGeoPoint); …
  • 20. var map = new YMap(document.getElementById('map')); … dev var currentGeoPoint = new YGeoPoint( _c.Lat, _c.Lon ); map.addMarker(currentGeoPoint); … … if (flickcurl_prepare(fc, "flickr.photos.geo.correctLocation", parameters, count)) { … } …
  • 21. var map = new YMap(document.getElementById('map')); … dev var currentGeoPoint = new YGeoPoint( _c.Lat, _c.Lon ); map.addMarker(currentGeoPoint); … … if (flickcurl_prepare(fc, "flickr.photos.geo.correctLocation", parameters, count)) { … } … http://search.yahooapis.com/ ImageSearchService/V1/imageSearch? appid=YahooDemo&query=Corvette&results=2
  • 22. var map = new YMap(document.getElementById('map')); … dev var currentGeoPoint = new YGeoPoint( _c.Lat, _c.Lon ); map.addMarker(currentGeoPoint); … … if (flickcurl_prepare(fc, "flickr.photos.geo.correctLocation", parameters, count)) { … } … http://search.yahooapis.com/ ImageSearchService/V1/imageSearch? appid=YahooDemo&query=Corvette&results=2 http://weather.yahooapis.com/ forecastrss?p=FRXX0076&u=c
  • 23. var map = new YMap(document.getElementById('map')); … dev var currentGeoPoint = new YGeoPoint( _c.Lat, _c.Lon ); map.addMarker(currentGeoPoint); … … if (flickcurl_prepare(fc, "flickr.photos.geo.correctLocation", parameters, count)) { … } … http://search.yahooapis.com/ ImageSearchService/V1/imageSearch? appid=YahooDemo&query=Corvette&results=2 http://weather.yahooapis.com/ forecastrss?p=FRXX0076&u=c
  • 24. var map = new YMap(document.getElementById('map')); … dev var currentGeoPoint = new YGeoPoint( _c.Lat, _c.Lon ); map.addMarker(currentGeoPoint); … … if (flickcurl_prepare(fc, "flickr.photos.geo.correctLocation", parameters, count)) { … } … http://search.yahooapis.com/ ImageSearchService/V1/imageSearch? appid=YahooDemo&query=Corvette&results=2 http://weather.yahooapis.com/ forecastrss?p=FRXX0076&u=c
  • 25. var map = new YMap(document.getElementById('map')); … dev var currentGeoPoint = new YGeoPoint( _c.Lat, _c.Lon ); map.addMarker(currentGeoPoint); … … if (flickcurl_prepare(fc, "flickr.photos.geo.correctLocation", parameters, count)) { … } … http://search.yahooapis.com/ ImageSearchService/V1/imageSearch? appid=YahooDemo&query=Corvette&results=2 http://weather.yahooapis.com/ forecastrss?p=FRXX0076&u=c
  • 26. var map = new YMap(document.getElementById('map')); … dev var currentGeoPoint = new YGeoPoint( _c.Lat, _c.Lon ); map.addMarker(currentGeoPoint); … … if (flickcurl_prepare(fc, "flickr.photos.geo.correctLocation", parameters, count)) { … } … http://search.yahooapis.com/ ImageSearchService/V1/imageSearch? appid=YahooDemo&query=Corvette&results=2 http://weather.yahooapis.com/ forecastrss?p=FRXX0076&u=c
  • 27. var map = new YMap(document.getElementById('map')); … dev var currentGeoPoint = new YGeoPoint( _c.Lat, _c.Lon ); map.addMarker(currentGeoPoint); ? … … if (flickcurl_prepare(fc, ? "flickr.photos.geo.correctLocation", parameters, count)) { … } … ? http://search.yahooapis.com/ ImageSearchService/V1/imageSearch? appid=YahooDemo&query=Corvette&results=2 ? http://weather.yahooapis.com/ forecastrss?p=FRXX0076&u=c
  • 28. var map = new YMap(document.getElementById('map')); … dev var currentGeoPoint = new YGeoPoint( _c.Lat, _c.Lon ); map.addMarker(currentGeoPoint); ? … … if (flickcurl_prepare(fc, ? "flickr.photos.geo.correctLocation", parameters, count)) { … } … ? http://search.yahooapis.com/ ImageSearchService/V1/imageSearch? appid=YahooDemo&query=Corvette&results=2 ? http://weather.yahooapis.com/ forecastrss?p=FRXX0076&u=c
  • 29. var map = new YMap(document.getElementById('map')); … dev var currentGeoPoint = new YGeoPoint( _c.Lat, _c.Lon ); map.addMarker(currentGeoPoint); … … if (flickcurl_prepare(fc, "flickr.photos.geo.correctLocation", parameters, count)) { … } … http://search.yahooapis.com/ ImageSearchService/V1/imageSearch? appid=YahooDemo&query=Corvette&results=2 http://weather.yahooapis.com/ forecastrss?p=FRXX0076&u=c
  • 30. dev YQL
  • 31. dev YQL
  • 32. dev Bindings YQL
  • 33. YQL in Practice 20 tiny steps to a working application You’ll need: Firefox Firebug Text editor
  • 34. Step 1. Login to the console with your Yahoo! login http://developer.yahoo.com/yql/console
  • 35. Step 2. Find the statement box and run the first query with test.
  • 36. Step 3. Check out the formatted view.
  • 37. Step 4. Run the statement “desc html”
  • 38. Step 5. Find the keys, note the required keys.
  • 39. Step 6. Get some HTML: select * from html where url = "http:// hubblesite.org/gallery/album/the_universe"
  • 40. Step 7. Check out the result. See the HTML in there?
  • 41. Step 8. Open http://hubblesite.org/gallery/album/the_universe in Firefox. Right click on a thumbnail and click “Inspect Element”
  • 42. Step 9. Find the element in Firebug. Right click and select “Copy XPath”
  • 43. Step 10. Add and xpath = "" to your query. Paste in the XPath from Firebug
  • 44. Step 11. Test your statement and refine your XPath.
  • 45. Step 12. Add limit 10 to your statement
  • 46. Step 13. Let’s get out of the console. Copy the “Rest Query” url into a new tab
  • 47. Step 14. Let’s embed this in a web page. Download the files from http://github.com/sh1mmer/dotnet-yql-tutorial
  • 48. Step 15. Add <script type="text/javascript" src="yql_js_widget.js"></script> to your HTML page.
  • 49. Step 16. Add some style: <style type="text/css"> li.imgCnt{ list-style: none; background:#000000; margin: 3px; float: left; } li.imgCnt img{ border:0; margin:5px; } li.imgCnt div.imgTitle{ padding: 5px; font-size: 11px; text- align:center; } </style>
  • 50. Step 17. Add another script node. Add config = {};
  • 51. Step 18. Format the output: var format = '<li class="imgCnt"> <img src="{src}" alt="{alt}"></li>';
  • 52. Step 19. Add you query; var yqlQuery = "" and add your query.
  • 53. Step 20. Add the render code: yqlWidget.push(yqlQuery,config,format,'widge tContainer'); yqlWidget.render();
  • 54. Fin.
  • 55. Tom Hughes-Croucher @sh1mmer croucher@yahoo-inc.com

Editor's Notes

  • #7: Lets take an example of a developer trying
  • #8: Lets take an example of a developer trying
  • #9: Lets take an example of a developer trying
  • #10: Lets take an example of a developer trying
  • #11: Lets take an example of a developer trying
  • #12: Lets take an example of a developer trying
  • #13: Lets take an example of a developer trying
  • #14: Lets take an example of a developer trying
  • #15: Lets take an example of a developer trying
  • #16: Lets take an example of a developer trying
  • #17: Lets take an example of a developer trying