@@ -161,19 +179,30 @@ template code:
+
1 | 2 | 3 |
4 | 5 | 6 |
7 | 8 | 9 |
+
+
+
+first | second | third | fourth |
+
+
+
1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 |
9 | | | |
+
]]>
diff --git a/libs/plugins/function.html_table.php b/libs/plugins/function.html_table.php
index 14622be6..10a9c5ad 100644
--- a/libs/plugins/function.html_table.php
+++ b/libs/plugins/function.html_table.php
@@ -34,10 +34,12 @@
*
* {table loop=$data}
* {table loop=$data cols=4 tr_attr='"bgcolor=red"'}
- * {table loop=$data cols=4 tr_attr=$colors}
+ * {table loop=$data cols="first,second,third" tr_attr=$colors}
*
* @author Monte Ohrt
- * @version 1.0
+ * @author credit to Messju Mohr
+ * @author credit to boots
+ * @version 1.1
* @link http://smarty.php.net/manual/en/language.function.html.table.php {html_table}
* (Smarty online manual)
* @param array
@@ -122,13 +124,15 @@ function smarty_function_html_table($params, &$smarty)
}
if (is_array($cols)) {
+ $cols = ($hdir == 'right') ? $cols : array_reverse($cols);
$output .= "\n";
+
for ($r=0; $r<$cols_count; $r++) {
$output .= '';
$output .= $cols[$r];
- $output .= " |
\n";
+ $output .= "\n";
}
- $output .= "\n";
+ $output .= "\n";
}
$output .= "\n";