file creation date copare user load date time...

Discussion in 'Programming' started by Peuplarchie, Nov 29, 2008.

  1. #1
    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 :

    
    
    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;
    
           
    }
    
    
    PHP:
    Thanks !
     
    Peuplarchie, Nov 29, 2008 IP
  2. JamieH

    JamieH Well-Known Member

    Messages:
    975
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    140
    Digital Goods:
    1
    Articles:
    1
    #2
    Would this not require a cron_job?

    I thought anything that needs to be updated at a certain time you'd need to use cron_job to run the script every so often so it updates, i can't quite understand your request sorry.

    Jamie
     
    JamieH, Nov 29, 2008 IP