Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 82 lines (77 sloc) 1.511 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
--TEST--
27.phpt: thead, tfoot, tbody with mixed function calls
--FILE--
<?php
// $Id$
require_once 'HTML/Table.php';
$table = new HTML_Table(null, null, false);

$thead =& $table->getHeader();
$tfoot =& $table->getFooter();
$tbody =& $table->getBody();

$thead->setAutoFill('foo');
$tfoot->setAutoFill('bar');

$data[0][] = 'Test';
$data[1][] = 'Test';
$data[2][] = 'Test';

foreach($data as $key => $value) {
    $thead->setCellAttributes($key, $key, array('style' => 'border: 1px solid purple;'));
    $tfoot->setCellContents($key, $key, 'some content', 'TH');
    $tbody->addRow($value, 'bgcolor="darkblue"');
}

// output
echo $table->toHTML();
?>
--EXPECT--
<table>
<thead>
<tr>
<td style="border: 1px solid purple;">foo</td>
<td>foo</td>
<td>foo</td>
</tr>
<tr>
<td>foo</td>
<td style="border: 1px solid purple;">foo</td>
<td>foo</td>
</tr>
<tr>
<td>foo</td>
<td>foo</td>
<td style="border: 1px solid purple;">foo</td>
</tr>
</thead>
<tfoot>
<tr>
<th>some content</th>
<td>bar</td>
<td>bar</td>
</tr>
<tr>
<td>bar</td>
<th>some content</th>
<td>bar</td>
</tr>
<tr>
<td>bar</td>
<td>bar</td>
<th>some content</th>
</tr>
</tfoot>
<tbody>
<tr>
<td bgcolor="darkblue">Test</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td bgcolor="darkblue">Test</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td bgcolor="darkblue">Test</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
Something went wrong with that request. Please try again.