• Jquery Timeago Implementation with PHP

    Nowadays timeago is the most important functionality in social networking sites, it helps to updating timestamps automatically. In this post I am just presenting a simple tip to implement timeago in a better way.

    Code:-

    Contains javascipt code. $(this).timeago()- here this element is refers to timeago class selector of the anchor tag.

    1
    2
    3
    4
    5
    6
    7
    8
    
    <script type="text/javascript" src="js/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">// <![CDATA[
    $(document).ready(function(){
    $(".timeago").livequery(function() // LiveQuery 
    {
    $(this).timeago(); // Calling Timeago Funtion 
    });
    });
    // ]]></script>

    HTML & PHP Code :-

    1
    2
    3
    4
    5
    6
    
     <!--?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

Comments on this post

Leave a Reply

  • Security Code :


    × 6 = eighteen