Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
 
3
/*
4
* This example shows how you can set row and col attributes
5
* with HTML_Table.
6
*/
7
// $Id: Table_example1.php 297540 2010-04-05 19:58:39Z wiesemann $
8
 
9
require_once 'HTML/Table.php';
10
$table = new HTML_Table('width = "400"');
11
 
12
$data[0][] = 'i am';
13
$data[0][] = 'i think';
14
$data[0][] = 'therefore';
15
$data[0][] = 'therefore';
16
 
17
$data[1][] = 'i think';
18
$data[1][] = 'i am';
19
$data[1][] = 'therefore';
20
$data[1][] = 'therefore';
21
 
22
$data[2][] = 'i am';
23
$data[2][] = 'therefore';
24
$data[2][] = 'i think';
25
$data[2][] = 'i think';
26
 
27
foreach($data as $key => $value) {
28
	$table->addRow($data[$key], array(array('bgcolor' => 'blue', 'align' => 'center'),
29
                                                           array('bgcolor' => 'green'),
30
                                                           array('bgcolor' => 'red')));
31
}
32
 
33
foreach($data as $key => $value) {
34
	$table->addRow($data[$key], array('bgcolor = "blue"','bgcolor = "green"','bgcolor = "red"'));
35
}
36
 
37
foreach($data as $key => $value) {
38
	$table->addRow($data[$key], 'bgcolor = "yellow" align = "right"', 'TD', true);
39
}
40
 
41
foreach($data as $key => $value) {
42
	$table->addRow($data[$key], array('bgcolor' => 'pink', 'align' => 'center'));
43
}
44
 
45
$table->setColAttributes(1, 'bgcolor = "purple"');
46
$table->updateColAttributes(2, array('bgcolor = "blue"','bgcolor = "green"','bgcolor = "red"'));
47
 
48
echo '<pre>';
49
var_dump($table->getCellAttributes(2, 2));
50
var_dump($table->getRowAttributes(8));
51
echo '</pre>';
52
echo $table->toHTML();
53
?>