Small patch for html_table

[email protected] (George Miroshnikov)
Newsgroups php.smarty.dev
Organization Infinity Creative Group
Message-ID <[email protected]>
Hello guys and girls.

I would like to propose a small patch for plugins/function.html_table.php
When there's not enough data supplied to fill the single row,
some useless empty cells appear in the tail.
This patch shrinks the columns number to the number of elements in
loop, if the number of elements is less then the number of columns.

If this behaviour will break backward compatibility, I would ask for
permission to add another parameter that will enable/disable this
feature.

Best regards,
George Miroshnikov.
html_table.txt (text/plain, 602 B)
Index: libs/plugins/function.html_table.php
===================================================================
RCS file: /repository/smarty/libs/plugins/function.html_table.php,v
retrieving revision 1.9
diff -u -r1.9 function.html_table.php
--- libs/plugins/function.html_table.php	21 Sep 2004 19:41:21 -0000	1.9
+++ libs/plugins/function.html_table.php	28 Nov 2004 00:37:58 -0000
@@ -94,6 +94,10 @@
             $cols = ceil($loop_count/$rows);
         }
     }
+    
+    if ($cols > $loop_count) {
+        $cols = $loop_count;
+    }
 
     $output = "<table $table_attr>\n";
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.