Skip to content

Instantly share code, notes, and snippets.

@bigin
Created February 16, 2017 14:16
Show Gist options
  • Save bigin/d64da893b32ba7ecc06145023bcc66df to your computer and use it in GitHub Desktop.
Save bigin/d64da893b32ba7ecc06145023bcc66df to your computer and use it in GitHub Desktop.
<?php
$catid = 9;
$imanager = imanager();
$itemMapper = $imanager->getItemMapper();
$limit = 10;
$start = !empty($_GET['page']) ? (((int)$_GET['page'] -1) * $limit +1) : 1;
$itemMapper->alloc($catid);
$simpleItems = $itemMapper->getSimpleItems('active=1');
$total = $itemMapper->countItems($simpleItems);
$simpleItems = $itemMapper->filterSimpleItems('position', 'DESC', $start, $limit, $simpleItems);
$pagination = $itemMapper->pagination();
?>
<div class="row">
<table class="u-full-width">
<thead>
<tr>
<th>Name</th>
<th>Created</th>
<th>Last update</th>
<th>File name</th>
</tr>
</thead>
<tbody>
<?php
foreach($simpleItems as $item) {
?>
<tr>
<td><?php echo $item->name; ?></td>
<td><?php echo date('Y-m-d', $item->created); ?></td>
<td><?php echo (!empty($item->updated) ? date('Y-m-d', $item->updated) : ''); ?></td>
<td><?php echo $item->filename; ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<div><?php echo $pagination; ?></div>
<div class="info-block">
<p>Total: <?php echo $total; ?> items</p>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment