home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / Table_example1.php < prev    next >
Encoding:
PHP Script  |  2004-03-24  |  1.3 KB  |  51 lines

  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,v 1.1 2002/10/21 12:57:41 mansion Exp $
  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'), array('bgcolor' => 'green'), array('bgcolor' => 'red')) );
  29. }
  30.  
  31. foreach($data as $key => $value) {
  32.     $table->addRow($data[$key], array('bgcolor=blue','bgcolor=green','bgcolor=red') );
  33. }
  34.  
  35. foreach($data as $key => $value) {
  36.     $table->addRow($data[$key], 'bgcolor=yellow align=right', 'TD', true );
  37. }
  38.  
  39. foreach($data as $key => $value) {
  40.     $table->addRow($data[$key], array('bgcolor' => 'pink', 'align' => 'center') );
  41. }
  42.  
  43. $table->setColAttributes(1, 'bgcolor=purple');
  44. $table->updateColAttributes(2, array('bgcolor=blue','bgcolor=green','bgcolor=red'));
  45.  
  46. echo '<pre>';
  47. var_dump($table->getCellAttributes(2, 2));
  48. var_dump($table->getRowAttributes(8));
  49. echo '</pre>';
  50. echo $table->toHTML();
  51. ?>