views:

283

answers:

1

Title pretty much explains what I want to do... I'm not a fan of using nested tables, so believe me, I'm unhappy and would so, so, so totally prefer something else... but, c'est la vie...

Essentially, I'm trying to figure out how to create a nested table utilizing the theme_table function... I can't seem to find any information on how to do that...

The markup I'm aiming to achieve ($data is the array of information that I'm building the table off of):

<table class="atb">
 <tbody>
 <tr class="action">
    <table class="inner-atb">
       <tr class="un"><td colspan="2">$data['name']</td></tr>
       <tr class="data">
          <td class="img">$data['image']</td>
          <td class="untext">
               <span class="untext-style">
                   <span class="untext">$data['text']</span>
                   <span class="separator"></span>
                   <span class="timestamp">$data['timestamp']</span>
               </span>
          </td>
       </tr>
    </table>
 </tr>
 </tbody>
</table>
A: 

The info you need can be found here.

What you need to do would be something like this disclaimer, not tested

$header_inner = array();
$rows_inner = array();
$rows_inner[] = array('data' => $data['name'], 'colspan' => 2, 'class' => 'un');
$rows_inner[] = array(
    array('data' => $data['image']),
    array('data' => '<span>...</span>'),

);
$header_outer = array();
$rows_outer = array(theme('table', $header_inner, $rows_inner, array('class' => 'inner-atb')));
$output = theme('table', $header_outer, $rows_outer);

I didn't put all the classes and stuff in, but have given you an overview of how to do it. If things fail check the doc link provided.

googletorp