Creating SlideShare Instant   Demo: http://home.iitb.ac.in/~saket.kumar/slideshare  Source:https://github.com/saketkc/Slid...
What is “Instant”?1.Get spontaneous results “on the go” while you type.2.Saves time3.First results are generally preffered...
SlideShare Instant ! Get instant results for your Slide/Document Search !Not Satisfied with the first result?? Go Click th...
Requirements                    1.AJAX calls (Hail Google !)                              2.PHP( My favourite on Web So fa...
Code Snippets      <input type="text" class=search_input /><br/>Define an “onkeyup” event sen an ajax GET request to ajax....
Contact MeI am a Sophomore at IIT   Bombay as of 2011 .  I can be contacted at   saketkc@gmail.com
Ajax.php<?phpsession_start();$var=array();global $vaar;//$var=[];if ($_GET[op]=="ajaxrequest"){$var=$_GET[query];$api_key=...
curl_setopt($ch, CURLOPT_PROXY, $proxy);curl_setopt($ch, CURLOPT_PROXYPORT,80);curl_setopt($ch, CURLOPT_PROXYUSERPWD,$pass...
if ($_GET[op]=="numberrequest"){// session_start();$num=$_GET[number];$query=$_GET[query];$api_key="8GD14Jk1";$secret="mnF...
$ch = curl_init();curl_setopt ($ch, CURLOPT_RETURNTRANSFER,1);curl_setopt($ch, CURLOPT_PROXY, $proxy);curl_setopt($ch, CUR...
<script type="text/javascript"src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script><scriptsrc="h...
$(#next).click(function() {  number=number+1;  var keyword = $(".search_input").val();  $.ajax({   type: "GET",   url: "aj...
$.ajax({   type: "GET",   url: "ajax.php",   data:{op:numberrequest,query:keyword,number:number},   success: function(msg)...
Upcoming SlideShare
Loading in...5
×

SlideShare Instant

1,119

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,119
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

SlideShare Instant

  1. 1. Creating SlideShare Instant Demo: http://home.iitb.ac.in/~saket.kumar/slideshare Source:https://github.com/saketkc/SlideShare-Instantt Saket Choudhary http://home.iitb.ac.in/~saket.kumar IIT Bombay
  2. 2. What is “Instant”?1.Get spontaneous results “on the go” while you type.2.Saves time3.First results are generally preffered reults hence search the “browsingExample:1. Google Search Instant(Results appear as you type)2. YouTube Instant : The thing that actually landd up its creator with a joboffer !
  3. 3. SlideShare Instant ! Get instant results for your Slide/Document Search !Not Satisfied with the first result?? Go Click the “Next” button !Not So Fast Yet ! Well the source code is all open Go edit it !Just Respect the Open Source Terms:https://github.com/saketkc/SlideShare-InstantDemo available at: http://home.iitb.ac.in/~saket.kumar/slideshare
  4. 4. Requirements 1.AJAX calls (Hail Google !) 2.PHP( My favourite on Web So far ! I am falling in love with RoR though) 3. Javascript(jquery) 4. CSS (Brains with Beauty is the way everyonr likes it ! )
  5. 5. Code Snippets <input type="text" class=search_input /><br/>Define an “onkeyup” event sen an ajax GET request to ajax.php containing the parameters: the ajaxeeequest and query $(".search_input").keyup(function() { var search_input = $(this).val(); var keyword= encodeURIComponent(search_input); $.ajax({ type: "GET", url: "ajax.php", data:{op:ajaxrequest,query:keyword}, success: function(msg){ $(.inner).html(msg); //fetch the Slide and echo it on the page } }); });
  6. 6. Contact MeI am a Sophomore at IIT Bombay as of 2011 . I can be contacted at saketkc@gmail.com
  7. 7. Ajax.php<?phpsession_start();$var=array();global $vaar;//$var=[];if ($_GET[op]=="ajaxrequest"){$var=$_GET[query];$api_key="8GD14Jk1";$secret="mnFaUN4s";$proxy="proxy";$pass="user:pwd";$timeout=0;$ts=time();$hash=sha1($secret.$ts);# use CURL library to fetch remote file$apiurl="http://www.slideshare.net/api/2/search_slideshows?q=$var";$ch = curl_init();curl_setopt ($ch, CURLOPT_RETURNTRANSFER,1);
  8. 8. curl_setopt($ch, CURLOPT_PROXY, $proxy);curl_setopt($ch, CURLOPT_PROXYPORT,80);curl_setopt($ch, CURLOPT_PROXYUSERPWD,$pass);$url = $apiurl."&api_key=$api_key&ts=$ts&hash=$hash&items_per_page=1";curl_setopt ($ch, CURLOPT_URL, $url);$file_contents = curl_exec($ch);$xml = simplexml_load_string($file_contents);$number=1;foreach ( $xml->Slideshow as $files){ $_SESSION[$var][$number]=$files->Embed; //echo $_SESSION[sad][2]; $vaar[$number]=$_SESSION[$var][$number]; echo ($vaar[$number]); $number=$number+1;}}
  9. 9. if ($_GET[op]=="numberrequest"){// session_start();$num=$_GET[number];$query=$_GET[query];$api_key="8GD14Jk1";$secret="mnFaUN4s";$proxy=”proxy”$pass="user:pwd”;$timeout=0;$ts=time();$hash=sha1($secret.$ts);# use CURL library to fetch remote file$apiurl="http://www.slideshare.net/api/2/search_slideshows?q=$query";
  10. 10. $ch = curl_init();curl_setopt ($ch, CURLOPT_RETURNTRANSFER,1);curl_setopt($ch, CURLOPT_PROXY, $proxy);curl_setopt($ch, CURLOPT_PROXYPORT,80);curl_setopt($ch, CURLOPT_PROXYUSERPWD,$pass);$url = $apiurl."&api_key=$api_key&ts=$ts&hash=$hash&items_per_page=$num";curl_setopt ($ch, CURLOPT_URL, $url);$file_contents = curl_exec($ch);//$res = simplexml_load_file($file_contents);$xml = simplexml_load_string($file_contents);$number=1;foreach ( $xml->Slideshow as $files){ $_SESSION[$var][$number]=$files->Embed;$vaar[$number]=$_SESSION[$var][$number];if ($number==$num){echo $files->Embed;} $number=$number+1;}}?>
  11. 11. <script type="text/javascript"src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script><scriptsrc="http://chrisslidesharehacks.googlecode.com/files/previewer2.js"></script><script type="text/javascript">$(document).ready(function(){var number=01;$(".search_input").focus();$(".search_input").keyup(function(){var search_input = $(this).val();var keyword= encodeURIComponent(search_input);$.ajax({ type: "GET", url: "ajax.php", data:{op:ajaxrequest,query:keyword}, success: function(msg){ $(.inner).html(msg); } });});
  12. 12. $(#next).click(function() { number=number+1; var keyword = $(".search_input").val(); $.ajax({ type: "GET", url: "ajax.php", data:{op:numberrequest,query:keyword,number:number}, success: function(msg){ $(.inner).html(msg);//=msg; } });});$(#prev).click(function() { number=number-1; var keyword = $(".search_input").val();
  13. 13. $.ajax({ type: "GET", url: "ajax.php", data:{op:numberrequest,query:keyword,number:number}, success: function(msg){ $(.inner).html(msg);//=msg; } });});});</script><body><center>SlideShare Instant Query<input type="text" class=search_input /><br/><div class="container"><div class="inner"></div><button id="next"> Next--</div><button id="prev">--Prev</div></div></center></body>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×