Preflight Projects Simple solutions to complex problems.

Dynamic table column headers with Smarty

For Bootstrap Datatables.

<table id="result">
    <thead>
        <tr>
            {section name=col loop=$topstails} 
                <th>{$topstails[col]}</th> 
            {/section}    
        </tr>
    </thead>
    <tbody>
        {foreach from=$table item=row }
            <tr>
                {foreach from=$row item=col}
                    <td>{$col}</td>    
                {/foreach}
            </tr>
            
        {/foreach}
    </tbody>
    <tfoot>
        {section name=col loop=$topstails} 
            <th>{$topstails[col]}</th> 
        {/section}            
    </tfoot>
    <tr>
  </table>
        
Go expose yourself someplace

0 Replies to “Dynamic table column headers with Smarty”

Leave a Reply

Your email address will not be published. Required fields are marked *

RSS
Follow by Email
Facebook
Google+
https://preflight.co.za/2018/10/20/dynamic-table-column-headers-with-smarty">
Twitter