// 현재페이지,총페이지수,한페이지에 보여줄 목록수,URL
function pagelisting($cur_page, $total_page, $n, $url) {
$retValue = "<table border='0' cellpadding='0' cellspacing='0'><tr>";
if ($cur_page > 1) {
$retValue .= "<td><a href='" . $url . "1'>[처음]</a> </td>";
$retValue .= "<td><a href='" . $url . ($cur_page-1) . "'>[이전]</a></td>";
} else {
$retValue .= "<td> </td>";
$retValue .= "<td> </td>";
}
$retValue .= "<td> ";
$start_page = ( ( (int)( ($cur_page - 1 ) / 10 ) ) * 10 ) + 1;
$end_page = $start_page + 9;
if ($end_page >= $total_page) $end_page = $total_page;
if ($start_page > 1) $retValue .= "<a href='" . $url . ($start_page-1) . "'>[이전10개]</a> ";
if ($total_page > 1) {
for ($k=$start_page;$k<=$end_page;$k++) {
if ($cur_page != $k) {
$retValue .= " <a href='$url$k'> [$k] </a> ";
} else {
$retValue .= " <b>$k</b> ";
}
}
}
if ($total_page > $end_page) $retValue .= "<a href='" . $url . ($end_page+1) . "'>[다음10개]</a>";
$retValue .= " </td>";
if ($cur_page < $total_page) {
$retValue .= "<td><a href='$url" . ($cur_page+1) . "'>[다음]</a></td>";
$retValue .= "<td> <a href='$url$total_page'>[마지막]</a></td>";
} else {
$retValue .= "<td> </td>";
$retValue .= "<td></td>";
}
$retValue .= "</tr></table>";
return $retValue;
}
댓글 없음:
댓글 쓰기