Размер файла: 2.65Kb
<?
function head()
{
echo '<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru">
<head>
<meta http-equiv="Content-Type" content="application/vnd.wap.xhtml+xml; charset=UTF-8"/>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/>
<link rel="stylesheet" href="style.css" type="text/css"/>';
}
function foot_wap()
{
echo '<div class="foot"><a href="/wap/">На главную</a><br/>';
echo 'Версия : <a href="/">WEB</a><br/></div>';
echo '</body></html>';
}
###############
function navigation_wap($url, $current_page, $all_pages) {
$center = $current_page;
$left1 = 1;
$left2 = 2;
$left3 = $current_page - 2;
$left4 = $current_page - 1;
$right1 = $current_page + 1;
$right2 = $current_page + 2;
$right3 = $all_pages - 1;
$right4 = $all_pages;
$_left1 = ( $left1 == $center || $left1 <= 0 ) ? null : '<a href="'.$url.'page=1">1</a> ';
$_left2 = ( $left2 == $center || $left2 > $center ) ? null : '<a href="'.$url.'page=2">2</a> ';
$_left3 = ( $left3 < 1 || $left3 == $center || $left3 == $left2 || $left3 == $left1 ) ? null
: '<a href="'.$url.'page='.$left3.'">'.$left3.'</a> ';
$_left4 = ( $left4 < 1 || $left4 == $center || $left4 == $left2 || $left4 == $left1 || $left4 == $right1 ) ? null
: '<a href="'.$url.'page='.$left4.'">'.$left4.'</a> ';
$_right4 = ( $right4 == $center || $right4 <= 0 ) ? null : ' <a href="'.$url.'page='.$all_pages.'">'.$all_pages.'</a>';
$_right3 = ( $right3 == $center || $right3 < $center ) ? null : ' <a href="'.$url.'page='.$right3.'">'.$right3.'</a>';
$_right2 = ( $right2 > $all_pages || $right2 == $center || $right2 == $right3 || $right2 == $right4 ) ? null
: ' <a href="'.$url.'page='.$right2.'">'.$right2.'</a>';
$_right1 = ( $right1 > $all_pages || $right1 == $center || $right1 == $right3 || $right1 == $right4 || $right1 == $left4 ) ? null
: ' <a href="'.$url.'page='.$right1.'">'.$right1.'</a>';
$left_interval = !empty($_left2) && !empty($_left3) ? '..' : null;
$right_interval = !empty($_right2) && !empty($_right3) ? '..' : null;
$page_back = $current_page > 1
? '<a href="'.$url.'page='.($current_page - 1).'"><<</a> '
: '<span style="color: gray"><<</span> ';
$page_forward = $current_page < $all_pages
? ' <a href="'.$url.'page='.($current_page + 1).'">>></a><br />'
: ' <span style="color: gray">>></span>';
echo $page_back.$_left1.$_left2.$left_interval.$_left3.$_left4.$center.$_right1.$_right2.$right_interval.$_right3.$_right4.$page_forward;
# вот такая кухня)) ^_^
}
?>