如何使用smarty / PHP创建表?

I've been working on this all day and have tried every possible solution I could find but nothing seems to be working. Here's a copy of my code (using Smarty template system):

<tr><td style="border-top: none;">

 <table>
    <tr><th colspan="7">TITLE OF THE TABLE</th></tr>

    {foreach from=$data.history item=tmp name=item}
            <tr><td colspan="1" class='{cycle name=color values="odd,even"}'>{$tmp->history}</td></tr>
    {/foreach}

 </table>

</td><tr>

If you looks in the foreach statement you'll see that I'm trying to create a new td for each piece of information. This is actually working. However, the problem is that it's not spanning them in the table like I want it to do.

I want each td to have its own column and for there to be a maximum of 7 columns. As of right now, there's only one column showing and every is just split between rows.

Ideally, I want there to be 7 columns per row, even if some of them have to be empty because there's not enough data to pull. Is there any way to do this?

I think you are missing a final </tr>

<tr><td style="border-top: none;">

 <table>
    <tr><th colspan="7">TITLE OF THE TABLE</th></tr>

    {foreach from=$data.history item=tmp name=item}
            <tr><td colspan="1" class='{cycle name=color values="odd,even"}'>{$tmp->history}</td></tr>
    {/foreach}

 </table>

</td><tr>
      ^^^ ------------> should be </tr>