TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Advanced PHP Programming (http://www.talkphp.com/advanced-php-programming/)
-   -   file creation date copare user load date time... (http://www.talkphp.com/advanced-php-programming/3682-file-creation-date-copare-user-load-date-time.html)

Peuplarchie 11-29-2008 09:48 AM

file creation date copare user load date time...
 
Good day to you all,
I have a piece of code which read a diredtory and return a list of txt file and display their content.
I was wondering if there would be a way of making that depending on the time the user load the page, the last created file would appear with their border a different color for 5 stage.

example:
if user load the page an hour after a file was created, border colored green...

here is my code :

PHP Code:


function drawList($list)
{  

      
$thelist ''
      
      
$i 0;
      foreach(
$list as $file=>$string)     
      {

$lines nl2br($string);

    
$usercmt explode("--"$file);
$messtime substr($usercmt[1], 0, -4);
$messtimecor str_replace("-"":"$messtime);
$usercmtcor strtoupper($usercmt[0]);

              
$thelist .= '<div id="test">';
              
$thelist .= "<div id=\"title\"><b>".$usercmtcor."</b> &agrave; ".$messtimecor."  (UTC)</div>";  
$lines=explode("\n",$lines);
foreach(
$lines as $key=>$line)
{  
$lines[$key]="<div class=\"contentalt\" style=\"border-top:0; border-left:0; border-right:0; border-bottom:0px  padding:0; \">{$line}</div>";  }
$lines=implode('',$lines);
              
$thelist .= "<div id=\"commentbg\">".$lines."</div><br/>";
              
$thelist .= '</div><br/><br/>';



}

    return 
$thelist;

       


Thanks !


All times are GMT. The time now is 03:07 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0