Файл: pages/user/news.php
Строк: 35
<?
if (!isset($urlType[2])) {
Redirection('/');
}
$us = $sql->fetch("SELECT * FROM `users` where link = ? ", [$urlType[2]]);
$us['login'] = output($us['login']);
$count_max = 9;
$count = $sql->rowCount("SELECT * FROM `news` WHERE `id_user` = '{$us['id']}' AND `act` = '1'");
$page_num = (!empty($_GET['page']) ? (int) $_GET['page'] : 1);
$page = page('?page=', $page_num , $count , $count_max);
$page['count'] = $count;
$page['page_num'] = $page_num;
$page['count_max'] = $count_max;
$PageConfig = [
'title' => 'Новости - '. $us['login'] .', страница №'. $page_num,
];
PageConfig($PageConfig);
$news = [];
$query = $sql->fetchAll("SELECT * FROM `news` WHERE `id_user` = '{$us['id']}' AND `act` = '1' ORDER BY `date_public` DESC LIMIT {$page['start']} , {$page['num']};");
foreach ($query AS $p) {
if (FileSystem::TextStrlen($p['title']) > 79) {
$p['title'] = FileSystem::TextCut($p['title'] , 80);
}
$p['text'] = output($p['text']);
$news[] = $p;
}
$t->assign('page', $page);
$t->assign('news', $news);
echo $t->fetch('news.razd');