Hi everyone
Any suggestion about what can I use for sort a table generated in a foreach with cakephp 2? I know almost anything JavaScript, and I see that this can be an opportunity to practice it, but where do you recommend getting started?
A part of the table code:
<tbody>
<?php
foreach ($list as $post): ?>
<tr id = "linePosts">
<?php if ($this->Session->read('logged') === true && $userRole === 'admin') { ?>
<td><?php echo $post['Post']['id']; ?></td>
<?php } ?>
<td>
<?php echo $this->Html->link($post['Post']['title'], array('action' => 'view', $post['Post']['id']));?>
</td>
<?php if (($this->Session->read('logged') === true) && ($userId === $post['Post']['user_id'] || $userRole === 'admin')) { ?>
<td>
<?php echo $this->Form->postLink(
'Deletar',
array('action' => 'delete', $post['Post']['id']),
array('confirm' => 'VocĂȘ tem certeza?')
)?>
<?php echo $this->Html->link('Editar', array('action' => 'edit', $post['Post']['id']));?>
</td>
<?php }
else if (($this->Session->read('logged') === true)){ ?>
<td>-</td>
<?php } ?>
<td><?php
$date = date_create($post['Post']['created']);
echo date_format($date, 'd/m/Y H:i:s'); ?></td>
</tr>
<?php endforeach;
?>
</tbody>