"; echo ""; $add_header_end = true; break; } case 1: if ($display_footer && !$footer_added) { echo ""; echo ""; $footer_added = true; $add_footer_end = true; break; } case 2: if (!$body_added) { echo ""; $body_added = true; } default: echo ""; break; } $colspan = 0; $row_trimmed = rtrim($csv_row); $row_data = csvstring_to_array_stacks_in_3_page12($row_trimmed, $sep, '"', ""); for ($c=0; $c < count($row_data); $c++) { // Convert UTF-8 characters $content = utf8_convert_stacks_in_3_page12($row_data[$c]); if ($colspan){ $colspan--; continue; } elseif ($rowspans[$c]){ $rowspans[$c]--; continue; } else { if (preg_match('/^--+/',$content,$colmatches)){ $colspan = strlen($colmatches[0]); $colspan_str = "colspan='$colspan'"; $content = substr($content, $colspan); } if (preg_match('/^\+\++/',$content,$rowmatches)){ $rowspan = strlen($rowmatches[0]); $rowspans[$c] = $rowspan; $rowspan_str = "rowspan='$rowspan'"; $content = substr($content, $rowspan); if ($colspan) { // This is for when something has both colspan & rowspan $counter = $c; $col_counter = $colspan - 1; while($col_counter) { $counter++; $rowspans[$counter] = $rowspan -1; $col_counter--; } } } if (preg_match('/^\s*%pgimport\((\S+)\)%/',$content,$imatches)){ $content = "
"; } $tag = !$row && $display_header ? 'th' : 'td'; if ($markdown) { echo "<$tag class='col$c' $colspan_str $rowspan_str>". Markdown($content) .""; } else { echo "<$tag class='col$c' $colspan_str $rowspan_str>$content"; } $colspan_str = null; $rowspan_str = null; if ($colspan){$colspan--;} if ($rowspans[$c]){$rowspans[$c]--;} } } echo ""; if ($add_header_end){ echo ""; $add_header_end = false; } if ($add_footer_end){ echo ""; $add_footer_end = false; } $row++; } } else { echo "

There was a problem opening your CSV file: $csv_path

"; echo "

If you using Rapidweaver's Resources, you will need to publish in order to see your table.

"; echo "

You can use an http:// url to your file once its been published in order to view it in Preview.

"; } ?>