summaryrefslogtreecommitdiffstats
path: root/table.php
diff options
context:
space:
mode:
Diffstat (limited to 'table.php')
-rw-r--r--table.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/table.php b/table.php
new file mode 100644
index 0000000..fd82c8b
--- /dev/null
+++ b/table.php
@@ -0,0 +1,27 @@
+<?php
+
+//table helper
+
+public function table($data, array $headers = array(), array $options = array()) {
+ //Create the table
+ echo '<table>\n';
+ echo '<tr>';
+ foreach ($headers as $k => $v)
+ {
+ echo "<th>$v</th>"
+ }
+ echo "</tr>\n"
+
+
+ foreach ($data as $item)
+ {
+ echo '<tr>'
+ foreach($header as $key => $value)
+ {
+ echo "<td>$data->$key</td>\n"
+ }
+ echo "</tr>\n"
+ }
+ echo "</table>"
+}
+?> \ No newline at end of file