View file 0-key.ru/System/class/pages.php

File size: 1.77Kb
<?PHP
# Навигация
function navigation($total,$page,$url)
	{
		if($page-1 > 0)
			{
				$left='<a href="'.$url.''.($page-1).'"><-Пред.</a>'; 
			}
		else
			{
				$left = '<-Пред.';
			}
		if($page+1 > 0 AND $page < $total)
			{
				$right = '<a href="'.$url.''.($page+1).'">След.-></a>';
			}
		else
			{
				$right = 'След.->';
			}
		if($page-3 > 0)
			{
				$first=' <a href="'.$url.'"><span class="pagination_button">1</span></a>..'; 
			}
		if($page-2 > 0)
			{
				$page2left=' <a style="text-decoration: none;color:#333333;" href="'.$url.''.($page-2).'"><span class="pagination_button">'.($page-2).'</span></a> '; 
			}
		if($page-1 > 0)
			{
				$page1left=' <a style="text-decoration: none;color:#333333;" href="'.$url.''.($page-1).'"><span class="pagination_button">'.($page-1).'</span></a> '; 
			}
		if($page+1 <= $total)
			{
				$page1right=' <a style="text-decoration: none;color:#333333;" href="'.$url.''.($page+1).'"><span class="pagination_button">'.($page + 1).'</span></a> '; 
			}
		if($page+2 <= $total)
			{
				$page2right=' <a style="text-decoration: none;color:#333333;" href="'.$url.''.($page+2).'"><span class="pagination_button">'.($page + 2).'</span></a> '; 
			}
		if($page+3 <= $total)
			{
				$page3right='..<a style="text-decoration: none;color:#333333;" href="'.$url.''.($total).'"><span class="pagination_button">'.($total).'</span></a>'; 
			}
		//return '<div class="text"><center>'.$first.$page2left.$page1left.'<b><span class="pages">'.$page.'</span></b>'.$page1right.$page2right.$page3right.'</center></div>';
		return '<div class="pagination"><center>'.$first.$page2left.$page1left.'<b><span class="pagination_select">'.$page.'</span></b>'.$page1right.$page2right.$page3right.'</center></div>';
	}
?>