Файл: app/admin/news/index.php
Строк: 26
<?php
Core::only('level', 3);
$smarty->header('Новости');
$listing[] = [
'title' => Lang::word('Добавить новость'),
'url' => '/admin/news/add',
'icon' => 'plus',
'div' => 'block'
];
$all = $db->query("SELECT `id` FROM `news` ")->rowCount();
$pages = new Pages($all, $config['pages']);
$query = $db->query("SELECT * FROM `news` ORDER BY `id` DESC LIMIT " . $start . ", " . $config['pages']);
while ($list = $query->fetch())
{
$options = null;
$options[] = [
'url' => '/admin/news/delete?id=' . $list['id'] . '',
'title' => Lang::word('Удалить')
];
$posts[] = [
'title' => Filter::text($list['title']),
'post' => Filter::output($list['text']),
'time' => Core::time($list['time']),
'options' => $options
];
}
if ($all == 0)
$posts[] = [
'title' => Lang::word('Нет новостей.')
];
$smarty->assign([
'post' => $posts,
'listing' => $listing
]);
$smarty->display('listing.tpl');
$smarty->display('posts.tpl');
$pages->view('?');
$smarty->footer();