Small patch for html_table

From: Date: Sun, 28 Nov 2004 00:52:49 +0000
Subject: Small patch for html_table
Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-2595@lists.php.net to get a copy of this message
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.

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";
« previous php.smarty.dev (#2595) next »