public function ShowNewsListing($list = 1) { global $bd_names, $config; $sql = ''; if ($this->category_id > 0) { $sql = ' WHERE category_id=' . $this->category_id . ' '; } $list = (int) $list; if ($list <= 0) { $list = 1; } if ($this->category_id > 0) { $category = CategoryManager::GetNameByID($this->category_id); } else { $category = 'Последние новости'; } $category_id = $this->category_id; $category_link = Rewrite::GetURL(array('category', $category_id), array('', 'cid')); ob_start(); include $this->GetView('news_header.html'); $html_news = ob_get_clean(); $news_pnum = $config['news_by_page']; $line = getDB()->fetchRow("SELECT COUNT(*) FROM `{$bd_names['news']}`" . $sql, false, 'num'); $newsnum = (int) $line[0]; if (!$newsnum) { $html_news .= $this->ShowPage('news_empty.html'); return $html_news; } $result = getDB()->ask("SELECT `id` FROM `{$bd_names['news']}`" . $sql . "ORDER BY `time` DESC LIMIT " . $news_pnum * ($list - 1) . "," . $news_pnum); while ($line = $result->fetch('num')) { $news_item = new News_Item($line[0], $this->st_subdir); $html_news .= $news_item->Show(); unset($news_item); } if ($newsnum) { $html_news .= $this->arrowsGenerator($this->work_link, $list, $newsnum, $news_pnum, 'news'); } return $html_news; }