네이버 스타일 페이징 만들기
페이지 정보
작성자 오원장쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 댓글 0건 조회 4,153회 작성일 13-03-26 15:33본문
1. common.lib.php 내에 get_paging() 아래 함수로 변경
// 현재페이지, 총페이지수, 한페이지에 보여줄 행, URL
function get_paging($write_pages, $cur_page, $total_page, $url, $add="") {
$str = "";
if ($cur_page < 2) $str .= "<div class=\"paginate center\"><span class=\"pre\">맨앞</span>";
else if ($cur_page > 1) $str .= "<div class=\"paginate center\"><a href='".$url.($start_page)."' class=\"pre\">맨앞</a>";
function get_paging($write_pages, $cur_page, $total_page, $url, $add="") {
$str = "";
if ($cur_page < 2) $str .= "<div class=\"paginate center\"><span class=\"pre\">맨앞</span>";
else if ($cur_page > 1) $str .= "<div class=\"paginate center\"><a href='".$url.($start_page)."' class=\"pre\">맨앞</a>";
$start_page = ( ( (int)( ($cur_page - 1 ) / $write_pages ) ) * $write_pages ) + 1;
$end_page = $start_page + $write_pages - 1;
$end_page = $start_page + $write_pages - 1;
if ($end_page >= $total_page) $end_page = $total_page;
if ($start_page > 1) $str .= "<a href='".$url.($start_page-1)."{$add}' class=\"pre\">이전</a>";
else if ($start_page = 1) $str .= "<span class=\"pre\">이전</span>";
else if ($start_page = 1) $str .= "<span class=\"pre\">이전</span>";
if ($total_page > 1)
{
for ($k=$start_page;$k<=$end_page;$k++)
{
if ($cur_page != $k)
$str .= "<a href='$url$k{$add}'><span>$k</span></a>";
else
$str .= "<strong>$k</strong> ";
}
}
{
for ($k=$start_page;$k<=$end_page;$k++)
{
if ($cur_page != $k)
$str .= "<a href='$url$k{$add}'><span>$k</span></a>";
else
$str .= "<strong>$k</strong> ";
}
}
if ($total_page > $end_page) $str .= "<a href='".$url.($end_page+1)."{$add}' class=\"next\">다음</a>";
else $str .= "<span class=\"next\">다음</span>";
else $str .= "<span class=\"next\">다음</span>";
if ($cur_page < $total_page) $str .= "<a href='$url".($total_page)."' class=\"next\">맨뒤</a></div>";
else $str .= "<span class=\"next\">맨뒤</span></div>";
else $str .= "<span class=\"next\">맨뒤</span></div>";
$str .= "";
return $str;
}
return $str;
}
2. style.css 파일 열어 아래 스타일 추가
/* 페이징 스타일 */
.paginate { padding:10px 0; }
.paginate a,
.paginate strong { position:relative; display:inline-block; margin-right:1px; padding:2px 4px 3px 4px; color:#000; text-decoration:none; border:1px solid #ffffff; font:bold 11px/normal Verdana; _width :17px; }
.paginate strong { color:#f23219 !important; border:1px solid #e9e9e9; }
.paginate .pre { margin-right:6px; padding:4px 6px 2px 14px; _padding-bottom:1px; background:url(/img/page/bg_page_left_off.gif) no-repeat 6px 6px !important; letter-spacing:-1px; }
.paginate .next { margin-left:4px; padding:4px 14px 2px 6px; _padding-bottom:1px; background:url(/img/page/bg_page_right_off.gif) no-repeat 38px 6px !important; letter-spacing:-1px; }
.paginate a.pre { background:url(/img/page/bg_page_left_on.gif) no-repeat 6px 6px !important; }
.paginate a.next { background:url(/img/page/bg_page_right_on.gif) no-repeat 38px 6px !important; }
.paginate .pre,
.paginate .next { display:inline-block; color:#ccc; border:1px solid #e9e9e9; position:relative; top:0; _top:-2px; font:11px/normal 돋움, Dotum; width:30px; _width :50px; }
.paginate a.pre,
.paginate a.next { color:#565656; }
.paginate a:hover { background-color:#f7f7f7 !important; border:1px solid #e9e9e9; }
.paginate { padding:10px 0; }
.paginate a,
.paginate strong { position:relative; display:inline-block; margin-right:1px; padding:2px 4px 3px 4px; color:#000; text-decoration:none; border:1px solid #ffffff; font:bold 11px/normal Verdana; _width :17px; }
.paginate strong { color:#f23219 !important; border:1px solid #e9e9e9; }
.paginate .pre { margin-right:6px; padding:4px 6px 2px 14px; _padding-bottom:1px; background:url(/img/page/bg_page_left_off.gif) no-repeat 6px 6px !important; letter-spacing:-1px; }
.paginate .next { margin-left:4px; padding:4px 14px 2px 6px; _padding-bottom:1px; background:url(/img/page/bg_page_right_off.gif) no-repeat 38px 6px !important; letter-spacing:-1px; }
.paginate a.pre { background:url(/img/page/bg_page_left_on.gif) no-repeat 6px 6px !important; }
.paginate a.next { background:url(/img/page/bg_page_right_on.gif) no-repeat 38px 6px !important; }
.paginate .pre,
.paginate .next { display:inline-block; color:#ccc; border:1px solid #e9e9e9; position:relative; top:0; _top:-2px; font:11px/normal 돋움, Dotum; width:30px; _width :50px; }
.paginate a.pre,
.paginate a.next { color:#565656; }
.paginate a:hover { background-color:#f7f7f7 !important; border:1px solid #e9e9e9; }
3. 첨부파일 이미지 css 이미지 경로에 복사
만약 이미지가 이상하게 나오면 list.skin.php 파일을 열어 아래 처럼 수정
<div class="board_page">
<?=$write_pages?>
</div>
<?=$write_pages?>
</div>
첨부파일
- page.zip (5.3K) 69회 다운로드 | DATE : 2013-03-26 15:33:31
댓글목록
등록된 댓글이 없습니다.