Jquery Timeago Implementation with PHP.
Wall Script
Wall Script
Wednesday, June 19, 2013

Jquery Timeago Implementation with PHP.

Nowadays timeago is the most important functionality in social networking sites, it helps to updating timestamps automatically. Recent days I received few requests from 9lessons readers that asked me how to implement timeago plugin with dynamic loading live data using PHP. In this post I am just presenting a simple tip to implement timeago in a better way.

Timeaog Jquery PHP.

Download Script     Live Demo

Why Live Query
LiveQuery utilizes the power of jQuery selectors by binding events or firing callbacks for matched elements auto-magically, even after the page has been loaded and the DOM updated.

Previous Post: http://www.9lessons.info/2010/01/php-time-stamp-function.html

Code
Contains javascipt code. $(this).timeago()- here this element is refers to timeago class selector of the anchor tag.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.livequery.js"></script>
<script type="text/javascript" src="js/jquery.timeago.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".timeago").livequery(function() // LiveQuery 
{
$(this).timeago(); // Calling Timeago Funtion 
});
});
</script>

//HTML & PHP Code
<?php
$time=time(); // Current timestamp eg: 1371612613
$mtime=date("c", $time); // Converts to date formate 2013-06-19T03:30:13+00:00 
?>

You opened this page <a href='#' class='timeago' title="<?php echo $mtime; ?>"></a>
web notification

38 comments:

  1. what about getting the right timezone from the client because when im using that script its showing -2

    ReplyDelete
  2. How can we get the client time?, not the server time? The local client time :)

    ReplyDelete
  3. You opened this page about an hour ago, and it is not refreshing. Google Chrome 27.

    ReplyDelete
  4. hey, thank you for the tutorial. I just want to know if you can help me to create a market watch on my own.

    thank you

    ReplyDelete
  5. Another great article!... Keep it up Srinivas

    ReplyDelete
  6. nice jquery plugin, i just knew about this timeago from jquery :D

    ReplyDelete
  7. Good work.... It will help me. Thanks for posting.

    ReplyDelete
  8. Simple and awesomatic.... nice tut...

    ReplyDelete
  9. If you could just implement a "time difference" so that we can substract current time from a time in our database (e.g. a post that has been made 5 minutes ago) and the difference changing live (like on facebook)

    ReplyDelete
  10. The post is pretty interesting. I really never thought I could have a good read by this time until I found out this site.

    ReplyDelete
  11. My system is taking future date due to that time difference i got is in negative.
    SO is there any way for time difference to non-negative and with correct calculation

    ReplyDelete
  12. its qualitively helpful
    thanks a lot

    ReplyDelete
  13. By using this we can develop very interactive thing. Nice one.

    ReplyDelete
  14. thanks for the tutorial. i am for sure gonna use this on my website

    ReplyDelete
  15. Awesome topic. I can't wait for another insightful tips from you. Keep it coming!

    ReplyDelete
  16. Very nice article, thanks for sharing.

    ReplyDelete
  17. how to display details content in php from mysql database using by click on read more button.

    ReplyDelete
  18. nice work.......

    ReplyDelete
  19. Why are you using LiveQuery and adding an extra http call to for an additional plugin that's not needed. LiveQuery is already built in to jQuery so that is unnecessary. It used to be .live.() now it is .on(). So you should be using .on() and not a livequery plugin.

    ReplyDelete
  20. Hmmmm..This s wat i need..cooll..!!!!!!!

    ReplyDelete
  21. I don't be sorry that spent a few of minutes for reading. Write more often, surely’ll come to read amazing new.

    ReplyDelete
  22. thank you so much for the post :D very helpfull

    ReplyDelete

mailxengine Youtueb channel
Make in India
X