read('events.xls'); // Excel file data is stored in $sheets property, an Array of worksheets /* The data is stored in 'cells' and the meta-data is stored in an array called 'cellsInfo' Example (firt_sheet - index 0, second_sheet - index 1, ...): $sheets[0] --> 'cells' --> row --> column --> Interpreted value --> 'cellsInfo' --> row --> column --> 'type' (Can be 'date', 'number', or 'unknown') --> 'raw' (The raw data that Excel stores for that data cell) */ // this function creates and returns a HTML table with excel rows and columns data // Parameter - array with excel worksheet data function sheetData($sheet,$eventType) { $re = ''; // starts html table $re .= ''; $x = 2; while($x <= $sheet['numRows']) { if (strtolower($sheet['cells'][$x][7]) == "$eventType" ) { $title = $sheet['cells'][$x][1]; $glanceTitle = $sheet['cells'][$x][2]; $description = $sheet['cells'][$x][3]; $startDate = $sheet['cells'][$x][4]; $endDate = $sheet['cells'][$x][5]; $patheToArt = $sheet['cells'][$x][6]; $type = $sheet['cells'][$x][7]; $startDateMod = strtotime($startDate); $endDateMod = strtotime($endDate); $todayDate = date("Y-m-d"); $todayDateMod = strtotime($todayDate); if ($endDateMod>=$todayDateMod) { $re .= ''; $re .= ""; $re .= ''; } } $x++; } return $re .'
$title
"; $re .= "
"; //$re .= "$description"; $re .= nl2br($description); $re .= "

'; // ends and returns the html table } $excel_data = ''; // to store the the html tables with data of each sheet // traverses the number of sheets and sets html table with each sheet data in $excel_data if (strtolower($_GET['et']) =='winery') { $imageName= "Fenestra Winery Events"; $eventType='winery'; } else { $imageName= "Fenestra Tour Events"; $eventType='tour'; } $excel_data .= "$imageName". sheetData($excel->sheets[0],$eventType) .'
'; ?>