페이지뷰를 이쁘게 만들어 보았습니다. > 그누4 팁자료실

그누4 팁자료실

그누보드4와 관련된 팁을 여러분들과 함께 공유하세요.
나누면 즐거움이 커집니다.

페이지뷰를 이쁘게 만들어 보았습니다. 정보

페이지뷰를 이쁘게 만들어 보았습니다.

본문

common.lib.php 의 18줄 부터 수정하시면 됩니다.
이렇케 하면 모든 게시판페이지에 한번에 적용됩니다.


// 현재페이지, 총페이지수, 한페이지에 보여줄 행, URL
function get_paging($write_pages, $cur_page, $total_page, $url, $add="")
{
    $str = "<table cellspacing='0'cellpadding='0' align='center' border='0'><tr>";
    if ($cur_page > 1) {
        $str .= "<td><a href='" . $url . "1{$add}'>처음</a> </td>";
        //$str .= "[<a href='" . $url . ($cur_page-1) . "'>이전</a>]";
    }

    $start_page = ( ( (int)( ($cur_page - 1 ) / $write_pages ) ) * $write_pages ) + 1;
    $end_page = $start_page + $write_pages - 1;

    if ($end_page >= $total_page) $end_page = $total_page;

    if ($start_page > 1) $str .= "<td><a href='" . $url . ($start_page-1) . "{$add}'>이전</a> </td>";
  
    $str .= "<td width='1' bgColor='#D5D5D5'></td>";

    if ($total_page > 1) {
        for ($k=$start_page;$k<=$end_page;$k++) {
            if ($cur_page != $k)
                $str .= " <td width='24' align='center' onmouseover=\"this.style.background='#F7F7F7'\" style=\"cursor:pointer;cursor:hand;\" onmouseout=\"this.style.background=''\" onclick=\"location.href='$url$k'\" valign='bottom'><FONT color='#000000'><span style='font-size:12px;'>$k</span></font></td><td width='1' bgColor='#D5D5D5'></td>";
            else
                $str .= " <td width='24' align='center' valign='bottom'><FONT color='#f98217'><span style='font-size:12px; font-weight:bold'>$k</span></font></td><td width='1' bgcolor='#D5D5D5'></td>";
        }
    }

    if ($total_page > $end_page) $str .= "<td> <a href='" . $url . ($end_page+1) . "{$add}'>다음</a></td>";

    if ($cur_page < $total_page) {
        //$str .= "[<a href='$url" . ($cur_page+1) . "'>다음</a>]";
        $str .= " <td> <a href='$url$total_page{$add}'>맨끝</a></td>";
    }
    $str .= "</tr></table>";

    return $str;
}

추천
12
  • 복사

댓글 11개

© SIRSOFT
현재 페이지 제일 처음으로