html_tables question - fixed

From: Date: Sun, 31 Oct 2004 16:04:13 +0000
Subject: html_tables question - fixed
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-15246@lists.php.net to get a copy of this message
Will anyone please help???
$table -> setRowAttributes(0, $hrAttrs, true); If i take out the "true" ie. $table -> setRowAttributes(0, $hrAttrs); The extra cell goes away. I did try to RTFM, but discovered this by "shotgunning" here and there. I wish the documentation was less "unix manual page like" and more conversational w/more examples. But anyway it's fixed;P Now I have to figured out why it did that so I can learn how it works. -------- Original Message -------- Subject: [PEAR] html_tables question Date: Sat, 30 Oct 2004 22:34:47 -0400 From: leegold <leegold2@verizon.net> To: pear-general@lists.php.net References: <54748422-2AC7-11D9-B705-000A95C91262@erikheerlein.com> 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();

« previous php.pear.general (#15246) next »