Re: How to use rowspan in HTML_Table

From: Date: Sat, 24 May 2003 15:54:46 +0000
Subject: Re: How to use rowspan in HTML_Table
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-5586@lists.php.net to get a copy of this message
<stnien@scw.homeip.net> wrote : > Hi, > > I have try to use HTML_Table. But I get a error result. I have > the php code: > > <?php > > require_once "HTML/Table.php"; > > $table =new HTML_Table(array('border'=>'1')); > $table->addRow(array('a1','a2'), > > array(array('colspan'=>'2'),array('colspan'=>'2'))); > $table->addRow(array('b1','b2','b3','b4')); > echo $table->toHTML(); > > ?> > > The result is: (HTML Source) > > <table border="1"> > <tr> > <td colspan="2">a1</td> > <!-- span --> > <td>&nbsp;</td> > <td>&nbsp;</td> > </tr> > <tr> > <td>b1</td> > <td>b2</td> > <td>b3</td> > <td>b4</td> > </tr> > </table> > > The 'a2' is not in row 1. Why? Anyone can give me a hint. > > PS: I use HTML_Table v1.5. $table = new HTML_Table(array('border'=>'1')); $table->addRow(array('a1', '', 'a2', ''), array('colspan'=>2)); $table->addRow(array('b1','b2','b3','b4')); echo $table->toHTML(); Your second colspan is done on a non existing cell because a2 is now part of the a1 colspanned cell. Just like in Dreamweaver, you first need to have all your cells if you want to col/rowspan them. HTH Bertrand Mansion Mamasam

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