html_tables question
| From: | leegold | Date: | Sun, 31 Oct 2004 02:34:47 +0000 |
| Subject: | html_tables question | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-15239@lists.php.net to get a copy of this message | ||
I want a table structure of one cell per row with each row having alternating color, so basically I'll end up - if say I have multiple rows - with rows of single "boxes" with content inside. It's not exactly tabular but it's what I need right now. But I'm having trouble, it renders with two (2) cells per row no matter what I try, one cell with my content an another skinny one with "N/A". How can I get rid of the extra skinny cell? Thanks.
require_once "HTML/Table.php"; // trying the table class
$table = new HTML_Table("table border=0 cellpadding=10 cellspacing=5");
// $table -> setAutoGrow(true);
// $table -> setAutoFill("n/a");
// $table -> setHeaderContents(0, 0, "Title");
// $table -> setHeaderContents(0, 1, "URL");
// $table -> setHeaderContents(0, 2, "Description");
$hrAttrs = array("bgcolor" => "#D9D9F3");
$table -> setRowAttributes(0, $hrAttrs, true);
....snip....
$table -> addRow(array($t_content.'<p>'.$url_col.'<p>'.$d_content));
$table->setColAttributes(0, array('class' => 'nameCol')); // do i need this?
$altRow1 = array("bgcolor"=>"#E0FFFF");
$altRow2 = array("bgcolor"=>"#DAF4F0");
$table -> altRowAttributes(1, $altRow1, $altRow2);
echo $table->toHTML();