How to implement jquery Timeago with php
In social media we can see that posting time changes frequently seconds ago, minutes ago and hours ago etc, so today i am going to write a tutorial on timeago jquery and its easy implementation with PHP. Please follow the instruction given in download package to implement it in your web applications.
[wpdm_file id=29]DEMO
Code
Contains javascript code. $(this).timeago() here this element is refers to timeago class selector of the anchor tag.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/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 Function }); }); </script>
//HTML & PHP Code
<?php $time=time(); // Current time-stamp eg: 1371612613 $mtime=date("c", $time); // Converts to date format 2013-06-19T03:30:13+00:00 ?> You opened this page <a href='#' class='timeago' title="<?php echo $mtime; ?>"></a>
Tutorial Categories:
it refused to work