"; // first of all, we need to pull all the filenames that MIGHT contain stories we need, so we can narrow them down. // the directory we need to read from is _Pagenumbers. $dir = $rootpath.'_Pagenumbers/'; // now we open the directory and read each filename in it. $dh = opendir($dir) or die(); while (false !== ($filename = readdir($dh))) { // if the last four characters of the filename are ".csv", and the first four characters aren't "news", then it's one of the filenames we need, // because it's one of our ordinary volume csv files. if((substr($filename,-4) == '.csv') && (substr($filename,0,4) != 'news') && (substr($filename,0,4) != '__ar')) { // just like in pager.php , our volume/issue information is in the first part of the filename. so split the filename up on dashes, // then $temp is the actual volume and issue (retrieved by splitting the first part of the filename by underscore. $volume = explode("-",$filename); $temp = explode("_",$volume[0]); // here we add zeroes to the issue numbers for proper numerical sorting by str_padding the string to 3 places. $temp[1] = str_pad($temp[1], 3, "0", STR_PAD_LEFT); // now we assign $files as an array where each line is of the form $temp0-$temp1. ([volume]-[issue]). $files[] = $temp[0]."_".$temp[1]; } } // now sort the files ordinarily. This gives us a weird order for the volumes (which are roman numerals), but puts all of the issues in correct order. sort($files); // We're going through all of the following rigmarole because romansort CANNOT BE COUNTED ON to sort by anything BUT roman numerals. // that means our ISSUE numbers don't necessarily end up in order! // this is just an iterator variable. $j = 0; // iterate through all the lines in $files. in each line, pull BACK out the volume and issue number by splitting it along dashes. // then put it into a temp array where the zeroth value in a line is the whole line and the first value is the volume. foreach($files as $key => $line) { $temp = explode("_",$line); $temparr[$key][0] = $line; $temparr[$key][1] = $temp[0]; } // now iterate through $allissues, and grab ALL the issues. foreach($temparr as $key => $line) { $newissues[] = str_pad(roman2num($line[1]), 8, "0", STR_PAD_LEFT).".".$line[0]; } // sort the issues. this should sort on that first volume number, and sort them in descending order, so we'll absolutely get the right volume numbers. rsort($newissues); // iterate through our current array and remove all the extraneous zeroes, as well as our sorting numbers! foreach($newissues as $key => $line) { // explode at the "." to retrieve our padded sort number. $line = explode(".",$line); // then, IF WE'RE IN 2007 OR ABOVE (volume is >= 9) ditch it by setting $line to just $line[1] and finish the rest of it. if($line[0] >= 0) { $line = $line[1]; // now replace out the zeroes that we put in way back when we first generated the sortable issue numbers. $line = str_replace('_00','_',$line); $line = str_replace('_0','_',$line); // this puts our edited $line into a new array. (what we work with in an iteration is basically a copy.) $newissues2[$key] = $line; } } // now we grab ALL our issues -- in this case, everything AT OR ABOVE issue ix_1-pages.csv, EXCEPT // the current issue. // array_shift($newissues2); $ourissues = ($newissues2); // this is where we use the importcsv function from extrafunctions.php . It takes a .csv file as input and returns an array of values. // the other parameters: $head=true says that our file has a header row; $delim sets the delimiter; $len sets the max line length. // the first file we want to use is the csv file of $ourpages[0]. require_once 'File/CSV/DataSource.php'; $mycsv = array(); for($i = 0; $i< sizeof($ourissues); ++$i) { $filetouse = $rootpath."_Pagenumbers/".$ourissues[$i]."-pages.csv"; $issuepasttemp[$i] = new File_CSV_DataSource; $issuepasttemp[$i]->load($filetouse); $ti = $issuepasttemp[$i]->countRows(); for($j = 0; $j < $ti; ++$j) { $line = $issuepasttemp[$i]->getRow($j); if($line[7] && $line[7] != "" && $line[7] != '' && trim($line[2]) == 'race' && substr($line[0],-7,7) == '-1.html') { // add a new value to $line, which is the date converted to UNIX timestamp for sorting. $line[11] = strtotime($line[7]); // now make ANOTHER new array with only dated articles. $mycsv[] = $line; } } } $dated = $mycsv; // Obtain a list of columns in $dated[], so we can multisort. foreach ($dated as $key => $row) { $link[$key] = $row[0]; // href $title[$key] = $row[1]; // title of story $date[$key] = $row[11]; // UNIX timestamp $realdate[$key] = $row[7]; // actual human date $shortname[$key] = $row[8]; // linking name in case we need it. $teaser[$key] = $row[9]; // any teaser copy that needs to go with the What's New entry $section[$key] = $row[2]; // the SECTION the thing belongs in } // Sort the data with the UNIX timestamp descending, then title ascending; make sure the other columns get added back in by sorting them too. array_multisort($date, SORT_DESC, SORT_NUMERIC, $title, SORT_ASC, $realdate, $link, $shortname, $teaser, $section); // we want to iterate through every $link[] to create a new sorted array grabbing all the (sorted) columns, as well as figuring out some other info. for($i = 0; $i < sizeof($link); ++$i) { $sorteddates[$i][0] = $link[$i]; $sorteddates[$i][1] = $title[$i]; $sorteddates[$i][2] = $date[$i]; $sorteddates[$i][3] = $shortname[$i]; $sorteddates[$i][4] = $teaser[$i]; $sorteddates[$i][5] = $realdate[$i]; $sorteddates[$i][6] = $section[$i]; } $ydnew = 0; ?> :::<?php echo $magname; ?>::: Event Coverage Archive

Event Coverage ARCHIVE

$line) { $yd = date('Y',$line[2]); $nicedt = date('Y',$line[2]); if($yd != $ydnew) { if($key != 0) { echo("\n\n"); } echo("


"); echo("
    \n"); } $href = $line[0]; $rtitle = $line[1]; if($line[2] < '1154408400') { $rtitle = null; $href = null; $shdate = null; } $shdate = date('m-d-y',$line[2]); echo("
  • $rtitle"); echo(" [$shdate]\n"); $ydnew = $yd; } echo("
\n"); ?>