Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > GD library for creating tables
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 26th May 15:19
osman
External User
 
Posts: 1
Default GD library for creating tables


Hello,
I'm looking for a library in PHP that will let me easily create tables
programmatically. It would be great if I can just specify information about
the rows/columns, what each cell should contain, etc, and the table would
get created automatically. I should be able to do anything I would be able
to do with normal HTML tables. Is there anything like that available?

Thanks,
Osman
  Reply With Quote


  sponsored links


2 26th May 15:19
th.heuer
External User
 
Posts: 1
Default GD library for creating tables


$arr = array(array('celldata row 1, col1', 'celldata row 1, col2'),
array('celldata row 2, col1', 'celldata row 2, col2'));
<table>
<tr>
<th>heading1</th>
<th>heading2</th>
</tr>
<?php foreach ($arr as &$row): ?>
<tr>
<?php foreach ($row as &$col): ?>
<td><?php echo $col ?></td>
<?php endforeach ?>
</td>
<?php endforeach ?>
</table>

Do you really need a library for that? I had thought about this too but
couln't come up with a good solution to do this generically and being as
flexible as this. All you have to do is copy/paste the html code and put
some php inbetween if you have a designed table with css and all that
jazz.

Tim
  Reply With Quote
3 26th May 15:19
osman
External User
 
Posts: 1
Default GD library for creating tables


Hey Tim,
Thanks for the reply. I'm actually looking for something to do that
exactly, but output it as an image (via GD, imageMagick, etc). I should've
been clearer; I mentioned it in the subject but not the actual e-mail.

There's actually a PEAR library that does that for HTML, HTML_Table:
http://pear.php.net/package/html_table/redirected. I'm looking for
something very similar, which will allow me to output as an image.
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666