Просмотр файла Pages/main.php

Размер файла: 1.04Kb
<?php
$title = 'Главная страница - Топ';
$count = $mysqli->query("SELECT `id` FROM `sait` WHERE `status` = '1' AND `ban` = '0' AND `hosts` > '0'")->num_rows;
if($count > 0)
	{ 
		$total = intval(($count-1)/$pages)+1;
		$page = abs(intval($_GET['page']));
		if(empty($page) OR $page < 0)
			{
				$page = 1; 
			}
		if($page > $total)
			{
				$page = $total; 
			}
		$past = intval($count/$pages);  
		$start = $page*$pages-$pages; 
		$top = $mysqli->query("SELECT `id`,`name`,`about`,`hosts`,`hits`,`in`,`out`,`url` FROM `sait` WHERE `status` = '1' AND `ban` = '0' AND `hosts` > '0' ORDER BY `hosts` DESC LIMIT ".$start.",".$pages."");
		while($row = $top->fetch_assoc()) 
			{
				$data[]=$row;
			}	
		if($count > $pages)
			{
				$navigation = navigation($total, $page, 'http://'.$home.'/');
			}	
	}
echo $twig->render('main/index.tpl',array('title' => $title, 'sait_name' => $set['name_sait'],'user_data' => $user_data, 'home' => $home, 'style' => $style, 'data' => $data, 'navigation' => $navigation));
?>