How to update the list of blogs asynchronously in RSS FEED??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
amitdubey2
Forum Commoner
Posts: 48
Joined: Tue Apr 13, 2010 10:13 pm

How to update the list of blogs asynchronously in RSS FEED??

Post by amitdubey2 »

Hello all,

I am creating a web application using Google AJAX Feed API to display 5 latest blog titles from a website.
The code which i am using is following -(The key which i used in this is for directory " localhost/rss/ ")

Code: Select all

<form action="" method="get">
How many feeds you want to show ??
<br />
<input type="text" name="x"value="" size="1" maxlength="2">
<br />
<input type="submit" value="submit">
</form>
<?php
$x=$_GET['x'];
?>
<html> 
  <head> 
    <script  type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAAv5uCBbSj0o9kkU3g2mXJThROC4bvNdgYBpkrp5Ijzw2YwsWbFxScFdgIEHgetqZJBTE81deWlOy71Q"></script> 
    <script type="text/javascript"> 
 
      google.load("feeds", "1"); 
 
      var defaultQuery = 'Webyog';
      function findFeeds(query) { 
        google.feeds.findFeeds(query, feedSearchDone); 
      } 
 
      function feedSearchDone(result) { 
        var el = document.getElementById('feedControl'); 
 
        if (result.error || result.entries.length <= 0) { 
          el.innerHTML = 'No Results Found'; 
          return; 
        } 
 
        // Create a feed control 
        var feedControl = new google.feeds.FeedControl(); 
 
        // Grab top 4.. 
        for (var i = 0; i < <?php echo $x ;?> ; i++) { 
          feedControl.addFeed(result.entries[i].url, result.entries[i].title); 
        } 
 
        feedControl.setLinkTarget(google.feeds.LINK_TARGET_BLANK); 
        feedControl.setNumEntries(1); 
        feedControl.draw(el); 
      } 
 
      google.setOnLoadCallback(function() {findFeeds(defaultQuery)}); 
 
    </script> 
  </head> 
 
  <body> 
    <div id="feedControl">Loading</div> 
  </body> 
</html>




But the thing is i want that application should update the list of blogs asynchronously at every user-specified interval of time.I am not getting any idea about this ...any suggetion will be wonderful ??? :dubious: :dubious:


regards
amit
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: How to update the list of blogs asynchronously in RSS FE

Post by Jonah Bron »

Just put all of that javascript into a function, and then use setInterval().
katierosy
Forum Commoner
Posts: 27
Joined: Wed Apr 07, 2010 8:39 am

Re: How to update the list of blogs asynchronously in RSS FE

Post by katierosy »

Yes : you may use jquery along with the set interval and see if it works, You can write setInterval(funname(),100) on

<script src="jquery.js"></script>

<script>
$(document).ready(function(){
setInterval(funname(),100)
});

function funname(){
// do refresh part here
}
</script>
amitdubey2
Forum Commoner
Posts: 48
Joined: Tue Apr 13, 2010 10:13 pm

Re: How to update the list of blogs asynchronously in RSS FE

Post by amitdubey2 »

hello katierosy ,

i tried it in several ways but not getting the things correctly..Actually i dont know much about javascript so, Can you please modify the above code and set the interval to 30 min for checking update feeds for that blog.
Please help me.. :idea: :dubious:




regards
amit
Post Reply