PHP html generator class -
i use class create html content
http://code.google.com/p/php-class-html-generator/
i try build table in way , html result wrong...
$messalist = array(...); $html = htmltag::createelement('table')->id( $attr['id'] ); foreach($messagelist $message){ $html->addelement('tr') ->addelement('td')->settext($message['subject']) ->addelement('td')->settext($message['from']) ->addelement('td')->settext($message['date']) ->addelement('td')->settext($message['size']); } echo $html;
how in right way? thanks
this generated html:
<table id="messagelist"> <tr> <td> <td> <td> <td>1.91kb</td>23 feb 11:56 am</td>to: me@me.com</td>re: helooo</td></tr> <tr> <td> <td> <td> <td>1.67kb</td>27 feb 6:56 am</td>me@me.com</td>re: helloo</td></tr></table>
and need:
<table id="messagelist"> <tr> <td>1.91kb<td></td>23 feb 11:56 am</td><td>to: me@me.com</td><td>re: helooo</td></tr> <tr> <td>1.67kb</td><td>27 feb 6:56 am</td><td>me@me.com</td><td>re: helloo</td></tr></table>
try:
foreach($messagelist $message){ $tr= $html->addelement('tr'); $tr->addelement('td')->settext($message['subject']); $tr->addelement('td')->settext($message['from']); $tr->addelement('td')->settext($message['date']); $tr->addelement('td')->settext($message['size']); }
Comments
Post a Comment