Last active
September 14, 2017 12:41
-
-
Save jasonglisson/420d393e7cb32f71939b to your computer and use it in GitHub Desktop.
Revisions
-
jasonglisson revised this gist
Sep 14, 2017 . No changes.There are no files selected for viewing
-
jasonglisson revised this gist
Feb 9, 2016 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ $rows = 1; if (($handle = fopen("<path to csv file>", "r")) !== FALSE) { echo '<table class="table table-bordered toggle-square-filled default breakpoint footable">'; -
jasonglisson created this gist
Feb 9, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,40 @@ $rows = 1; if (($handle = fopen($row->field_field_results_data_file[0]['raw']['uri'], "r")) !== FALSE) { echo '<table class="table table-bordered toggle-square-filled default breakpoint footable">'; while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $num = count($data); if ($rows == 1) { echo '<thead><tr>'; } else { echo '<tr>'; } for ($c=0; $c < $num; $c++) { //echo $data[$c] . "<br />\n"; if(empty($data[$c])) { $value = " "; } else { $value = $data[$c]; } if ($rows == 1) { echo '<th>'.$value.'</th>'; } else { echo '<td>'.$value.'</td>'; } } if ($rows == 1) { echo '</tr></thead><tbody>'; } else { echo '</tr>'; } $rows++; } echo '</tbody></table>'; fclose($handle); } else { echo '<h4>No CSV file found</h4>'; }