Файл: core/cuctema/function/page.php
Строк: 450
<?
function page($k_p=1){ // Выдает текущую страницу
$p=1;
if (isset($_GET['p'])){
if ($_GET['p']=='end')$p=intval($k_p);elseif(is_numeric($_GET['p'])) $p=intval($_GET['p']);}
if ($p<1)$p=1;
if ($p>$k_p)$p=$k_p;
return $p;}
function k_page($k_post=0,$k_p_str=10){ // Высчитывает количество страниц
if ($k_post!=0){$v_pages=ceil($k_post/$k_p_str);return $v_pages;}
else return 1;}
function str($link='?',$k_p=1,$p=1){ // Вывод номеров страниц (только на первый взгляд кажется сложно ;))
?>
<style>
.pagination a.prev span,.pagination a.next span {
//color:#069;
color: #006666;
font-size:14px;
}
.pagination a {
text-decoration:none;
}
.pagination_ar {
font-size: 0px;
margin-bottom: 5px;
}
.pagination .pagination_ar .page {
color:#06F;
}
.pagination {
background: #FCFCFC;
padding:7px 10px;
border-left:1px solid #B3B3B3;
border-right:1px solid #B3B3B3;
}
.page_links input.page_choose,.pagination a.prev,.pagination a.next,.pagination .page_links,.pagination .page_links a {
color:#666;
}
.pagination a.prev span,.pagination a.next span {
text-decoration:underline;
}
.pagination .pagination_ar .page {
background:#f5f5f5
}
.pagination a.prev:hover span,.pagination a.next:hover span,.pagination .pagination_ar .page:hover {
color:red;
}
.pagination_ar {
margin-bottom:5px;
font-size:0
}
.pagination .page_links,.pagination .page_links a {
vertical-align:baseline
}
.pagination .page_links a,.pagination .page_links .current,.page_links input.page_choose {
margin:0 0px 0px 0;
/*
-webkit-border-radius:4px;
border-radius:4px
*/
}
.pagination .page_links a,.page_num_input,.pagination .page_links i,.pagination .page_links .current,.page_links input.page_choose, .pagination_ar a,.pagination_ar .page {
font-size:medium;
}
.pagination_ar .page {
font-size:small;
}
.page_num_input {
width: 20px;
padding:4px;
margin:0;
margin-right: 4px;
border: 1px solid #B3B3B3;
background:#fff url(http://i.spaces.ru/pagination_page_num_input.png) left top repeat-x;
}
.pagination .pagination_ar .page {
padding:0;
}
.pagination .pagination_ar .page {
margin:0;
}
input[type="submit"].bt-2,input[type="submit"].go {
background:#FCFCFC;
background:-webkit-gradient(linear,left top,left bottom,from(#FCFCFC),to(#e6e6e6));
background:-moz-linear-gradient(top,#FCFCFC,#e6e6e6);
background:-o-linear-gradient(top,#FCFCFC,#e6e6e6);
color: #666666;
font-size:medium;
border:1px solid #a0a0a0;
text-shadow:1px 1px 0 #fff;
padding:4px 8px;
margin-left: 2px;
-webkit-border-radius: 0px;
border-radius: 0px;
cursor: pointer;
}
.pagination {
border-bottom: 1px solid #CCCACA;
}
.text_input {
background:#fff url(http://i.spaces.ru/pagination_page_num_input.png) left top repeat-x;
}
.pagination .pagination_ar .page {
border:none
}
.pagination_ar,.page_links {
_font-size:medium;
}
.pagination .page_links,.pagination .page_links a {
vertical-align:baseline
}
.page_links a,.page_links input.page_choose,button.custom_button {
display:inline-block;
background:#FCFCFC;
background:-webkit-gradient(linear,left top,left bottom,from(#FCFCFC),to(#e6e6e6));
background:-moz-linear-gradient(top,#FCFCFC,#e6e6e6);
background:-o-linear-gradient(top,#FCFCFC,#e6e6e6);
padding:4px;
border:1px solid #cdcdcd;
border-left: none;
}
.pages_all {
display:inline-block;
padding:4px;
background:#FCFCFC;
border-left: medium none currentColor;
border-right: 1px solid #CDCDCD;
border-left: none;
}
.pages_all:hover {
cursor: default;
}
.page_links input.page_choose {
padding:1px 5px
}
.page_links a:hover,.page_links input.page_choose:hover {
background:#FCFCFC;
background:-webkit-gradient(linear,left top,left bottom,from(#FCFCFC),to(#d0d0d0));
background:-moz-linear-gradient(top,#FCFCFC,#d0d0d0);
background:-o-linear-gradient(top,#FCFCFC,#d0d0d0);
}
.page_links a:active,.page_links input.page_choose:active {
background:#d0d0d0;
background:-webkit-gradient(linear,left top,left bottom,from(#d0d0d0),to(#FCFCFC));
background:-moz-linear-gradient(top,#d0d0d0,#FCFCFC);
background:-o-linear-gradient(top,#d0d0d0,#FCFCFC);
}
.page_links .separate {
padding:1px 2px
}
.small_screen .page_links .search_page_block {
padding:1px 3px 1px 0
}
.page_links .current,input[type= "submit"].main_submit,input[type="submit"].green_button,.white,input[type="submit"].positive_button {
color:#fff
}
.search_page_block i,.page_links .current,.busi,.page_is,div.block {
padding:4px
}
.page_links,.font0 {
font-size:0
}
.page_links i {
padding:0 4px
}
.page_links .current {
background:#686868;
background:-webkit-gradient(linear,left top,left bottom,from(#858585),to(#C1C0C0));
background:-moz-linear-gradient(top,#858585, #C1C0C0);
background: -o-linear-gradient(top, #858585, #C1C0C0);
border:1px solid #8F8F8F
}
.current:hover {
cursor: default;
}
.pagination_ar,.page_links {
_font-size:medium;
font-size: 0px;
margin-bottom: 5px;
}
.page_links a:hover {
_text-decoration:none;
_background:#fefefe;
}
.page_links .current {
_color:#fff;
}
.page_links a:hover, .page_links input.page_choose:hover, button.custom_button:hover {
background: -webkit-gradient(linear,left top,left bottom,from(#FCFCFC),to(#d0d0d0));
}
.page_links a:active, .page_links input.page_choose:active, button.custom_button:active {
background:-webkit-gradient(linear,left top,left bottom,from(#d0d0d0),to(#FCFCFC));
}
/*
.round_corners, .busi_switcher table a, .busi_switcher table span.active_item, .button_block input, .form_button, .friends_access_list, input[type="submit"].main_submit, input[type="submit"].green_button, .edit_button {
-webkit-border-radius: 4px;
border-radius: 4px;
}
*/
.go {
border: 1px solid #a0a0a0;
text-shadow: 1px 1px 0 #fff;
padding: 3px 8px;
margin: 0;
}
.go:hover {
background:#fefefe;
background:-webkit-gradient(linear,left top,left bottom,from(#fefefe),to(#d0d0d0));
background:-moz-linear-gradient(top,#fefefe,#d0d0d0);
background:-o-linear-gradient(top,#fefefe,#d0d0d0);
}
.go:active {
background:#d0d0d0;
background:-webkit-gradient(linear,left top,left bottom,from(#d0d0d0),to(#fefefe));
background:-moz-linear-gradient(top,#d0d0d0,#fefefe);
background:-o-linear-gradient(top,#d0d0d0,#fefefe);
}
.go {
background: #fefefe;
background: -webkit-gradient(linear,left top,left bottom,from(#fefefe),to(#e6e6e6));
background: -moz-linear-gradient(top,#fefefe,#e6e6e6);
background: -o-linear-gradient(top,#fefefe,#e6e6e6);
font-size:medium;
border:1px solid #a0a0a0;
text-shadow:1px 1px 0 #fff;
padding:3px 8px;
margin-left: 2px;
-webkit-border-radius:4px;
border-radius:4px;
cursor: pointer;
}
.separate_links_item {
border-left: 1px solid #CCC;
margin: 0 8px;
}
.pagination_ar {
font-size: 0px;
margin-bottom: 5px;
}
</style>
<?
if ($p<1)$p=1;
$i=NULL;
echo '<form method="get" action="'.$link.'sid=&" style="background: rgba(0, 0, 0, 0);margin: 0px;padding: 0px;">';
echo "<div class='pagination'>n";
echo "<div style='pagination_ar'>n";
if ($p>1)echo "<a href='".$link."p=".($p-1)."' class='prev'><span>← Предыдущая</span></a>n";
if ($p<$k_p)echo ($p>1?"<i class='separate_links_item'></i>":NULL)."<a href='".$link."p=".($p+1)."' class='next'><span>Следующая →</span></a>n";
echo "</div><div style='margin-bottom: 4px;'></div>n";
echo "<div class='page_links'>n";
if ($p!=1)echo "<a href='".$link."p=1' style='border-left: 1px solid #CDCDCD;'><span> 1 </span></a>$in";
else echo "<span class='current'><span> 1 </span></span>$in";
for ($ot=-3; $ot<=3; $ot++){
if ($p+$ot>1 && $p+$ot<$k_p){
if ($ot==-3 && $p+$ot>2)echo " <i class='pages_all' style='padding:4px;'>..</i>";
if ($ot!=0)echo "<a href='".$link."p=".($p+$ot)."'><span> ".($p+$ot)." </span></a>$in";
else echo "<span class='current'><span> ".($p+$ot)." </span></span>$in";
if ($ot==3 && $p+$ot<$k_p-1)echo " <i class='pages_all' style='padding:4px;'>..</i>";}}
if ($p!=$k_p)echo "<a href='".$link."p=end'><span> $k_p </span></a><i></i>n";
elseif ($k_p>1)echo "<span class='current'><span> $k_p </span></span></a><i></i>n";
?>
<span class="wrap_page_num_input">
<input name="p" size="3" style="border-radius: 0px;-wap-input-format:'5N'" maxlength="5" value="" class="page_num_input" />
</span>
<input type="submit" value="GO" class="go" />
</span>
<?
echo "</div>n";
echo "</div>n";
echo '</form>';
}
?>