View file top_reit/rustats.su/system/controller/news.class.php

File size: 1.14Kb
<?php
class news{
	public function index(){
		Template::head('Новости топа');
		Template::run(__CLASS__, 'index');
		Template::foot();
	}
	
	public function ad(){
		if(isset($_GET['get']) && Core::count("SELECT COUNT(*) FROM `news` WHERE `id` = ?", array($_GET['get'])) == true){
			$news = Core::query("SELECT * FROM `news` WHERE `id` = ?", array($_GET['get'])) -> fetch();
			Template::head('Новость - '.Protect::title($news['name']));
			Template::run(__CLASS__, 'news');
			Template::foot();
		}else{
			Core::redirect('/news', 'Новость не найдена');
		}
	}
		public function comments(){
		require_once  MODEL.'news.class.php';
					$obj = new news_model();
			$obj -> com();
		if(isset($_GET['get']) && Core::count("SELECT COUNT(*) FROM `news` WHERE `id` = ?", array($_GET['get'])) == true){
			$news = Core::query("SELECT * FROM `news` WHERE `id` = ?", array($_GET['get'])) -> fetch();
			
			Template::head('Коментарии к новости - '.Protect::title($news['name']));
			Template::run(__CLASS__, 'comments');
			Template::foot();
		}else{
			Core::redirect('/news', 'Новость не найдена');
		}
	}
}
?>