Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New Coder
    Join Date
    Oct 2005
    Thanked 0 Times in 0 Posts

    Lightbulb time ago not showing for all files


    I got this below code to be working.. BUT it seems to show the timeago for all the files the same thing..

    PHP Code:
    //begin timeago
    $time "".fileatime("users/$username$viewurl/$filearray[$index]");
    humanTiming ($time)

    $time time() - $time// to get the time since that moment

    $tokens = array (
    31536000 => 'year',
    2592000 => 'month',
    604800 => 'week',
    86400 => 'day',
    3600 => 'hour',
    60 => 'minute',
    => 'second'

        foreach (
    $tokens as $unit => $text) {
            if (
    $time $unit) continue;
    $numberOfUnits floor($time $unit);
    $numberOfUnits.' '.$text.(($numberOfUnits>1)?'s':'');

    //end of timeago 
    and here is the code which list all the files in my directory including the echo of the above ...

    PHP Code:
    echo "<a id=\"$filearray[$index]\" href=\"readfile.php?file=" $username "/" $filearray[$index] . "\">" $filearray[$index] . "</a>  ";

    "".round(($fileinfo['size']/1024),2)." KB  ";
    ''.humanTiming($time).' ago';

    "".round((($fileinfo['size']/1024)/1024),2)." MB  ";
    ''.humanTiming($time).' ago';

    How can I modify or would you please help in a way, the timeago loops or works for each individual file and show time individually?

    thank you
    Last edited by pagedrop; 07-15-2012 at 11:55 PM.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts