<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.30.3">
</HEAD>
<BODY>
Theme table works like a charm, here's one example I took out my current project (and stripped it from unneeded stuff) so you can just copy it, and see that setting style works (D6):<BR>
<BR>
<?php<BR>
$rows = array();<BR>
$rows[0][0] = array('data' => '1');<BR>
$rows[0][1] = array('data' => '2');<BR>
$rows[0][2] = array('data' => '3');<BR>
$rows[0][3] = array('data' => '4');<BR>
$rows[0][4] = array('data' => '5');<BR>
$rows[0][5] = array('data' => '6');<BR>
$rows[0][6] = array('data' => '7');<BR>
$rows[1][0] = array('data' => 'a');<BR>
$rows[1][1] = array('data' => 'b');<BR>
$rows[1][2] = array('data' => 'c');<BR>
$rows[1][3] = array('data' => 'd');<BR>
$rows[1][4] = array('data' => 'e');<BR>
$rows[1][5] = array('data' => 'f');<BR>
$rows[1][6] = array('data' => 'g');<BR>
print theme_table(array(), $rows, array('class' => 'a-table-class', 'style'=> 'width: 400px;'), NULL);<BR>
?><BR>
<BR>
If it doesn't display as expected, check if you've maybe overridden theme_table in your theme.<BR>
<BR>
On Thu, 2010-10-28 at 18:14 -0700, Blake Senftner wrote:<BR>
<BLOCKQUOTE TYPE=CITE>
Hmmm... I have the following logic in a module's hook_view() creating a table out of programmatically generated information:
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
$header = array(t($node->title), t('Values:'));
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
$rows = array(array('<strong>Project status:</strong>', $statusMarkup),
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
array('<strong>Notes:</strong>', $node->content['body']['#value']),
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
array('<strong>Images:</strong>', $imagesMarkup),
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
array('<strong>Image Tags:</strong>', $imageTagMarkup),
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
array('<strong>Reconstructions:</strong>',$reconsMarkup),
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
array('<strong>Actions:</strong>', $actionsMarkup));
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
$table = theme('table', $header, $rows, array('style' => 'width: 770px', 'class' => 'form-item'));
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
$node->content['body']['#value'] = $table;
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
Notice that portion where I declare the width of the table to only be 770px? That is being ignored... I've tried variations like:
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
array( 'width' => '770px', ...) [note not 'style' here] and array( 'style' => 'width: 77px;', ...) [note added semicolon here]
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
When I don't use the 'style' attribute, the sticky-header gets a style setting with the width set to '877.617px;', so it looks like the 'style' usage is what I need, but I'm not finding the magic combination...
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
<BR>
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
any advice?
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
Sincerely,
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
-Blake
</BLOCKQUOTE>
<BLOCKQUOTE TYPE=CITE>
<BR>
<BR>
</BLOCKQUOTE>
<BR>
<BR>
</BODY>
</HTML>