<link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.12/css/jquery.dataTables.css">

<script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.12/js/jquery.dataTables.js"></script>
<h1>User Messages</h1>
<table width="100%"> <tr><td>
<table id="table_id">
    <thead>
    <tr>
        <th>Login</th>
        <th>Date</th>
        <th>Message</th>
    </tr>
    </thead>
    <tbody>
    {foreach $Messages item=message key=i}
        {if $message[5] == 0}
          <tr style="background: #9bbacc">
        {else}
               <tr>
        {/if}
            <td><a href="/admin/usermessages/{$i}">{$i}</a></td>
            <td><a href="/admin/usermessages/{$i}">{$message[2]|date_format:"%D %H:%M"}</a></td>
            <td><a href="/admin/usermessages/{$i}">{$message[4]}</a></td>

        </tr>
    {/foreach}
    </tbody>
</table>
        </td></tr></table>
<script>
    $(document).ready(function(){
        $('#table_id').DataTable();
    });
</script>