Monday, 21 October 2013

Timeago using jquery and php

Share it Please
The timeago fuctionality is important feature in all sites either in comments system or in social network since it shows the time that event happend. In this tutorial we are going to see the use of two jquery plugins "timeago.js and livequery.js "

Live Demo here


how to implement
<script type="text/javascript" src="js/jquery.timeago.js"></script>
<script type="text/javascript">
$(".timeago").livequery(function() // LiveQuery 
$(this).timeago(); // Calling Timeago Funtion 
//HTML & PHP Code
$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>

No comments:

Post a Comment