|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
stagnate Smarty n00b
Joined: 08 Feb 2005 Posts: 2
|
Posted: Tue Feb 08, 2005 1:12 am Post subject: Patch for html_table to provide for header columns |
|
|
I made a slighty modification for html_table that allows for the first row of the area to be treated as a header with it's own attributes (header_attr). This is big for me, and I would expect a lot of people would like to use it. If you don't pass header_attr everything works as expected.
I did not modify the tr_attr handling, so it will be off by one (start at the 2nd value and proceed); this can be easily changed if that's preferable.
The patch is easy, first update the param handling it just like table_attr, then within the row loop add a check for first row and header_attr param.
Let me know what you think.
Code: |
foreach ($params as $_key=>$_value) {
switch ($_key) {
case 'loop':
$$_key = (array)$_value;
break;
case 'cols':
case 'rows':
$$_key = (int)$_value;
break;
case 'table_attr':
+ case 'header_attr':
case 'trailpad':
case 'hdir':
case 'vdir':
$$_key = (string)$_value;
break;
case 'tr_attr':
case 'td_attr':
$$_key = $_value;
break;
|
Code: |
for ($r=0; $r<$rows; $r++) {
+ if ($r==0 && !empty($params['header_attr'])) {
+ $output .= "<tr $header_attr>\n";
+ } else {
$output .= "<tr" . smarty_function_html_table_cycle('tr', $tr_attr, $r) . ">\n";
+ }
$rx = ($vdir == 'down') ? $r*$cols : ($rows-1-$r)*$cols;
| [/code] |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|