주소에 &page=2&page=1&page=2 이런식으로 연이어 붙어버려요.
본문
안녕하세요. :)
페이징이 가능한 최근게시물을 사용하고 있습니다.
$_SERVER['REQUEST_URI']로 현재주소를 불러오는데요.
사용에 문제는 없지만 현재주소를 그대로 불러오다보니,
목록을 누를때마다 주소끝에
&page=2&page=1&page=2 이런식으로 연이어 붙어버려서요.
어떻게 해결할 방법이 없을까요?
목록을 누를때마다 주소끝에
&page=2&page=1&page=2 이런식으로 연이어 붙어버려서요.
어떻게 해결할 방법이 없을까요?
<?
if (!defined('_GNUBOARD_')) exit;
if (!defined('_GNUBOARD_')) exit;
// 최신글 추출
function latest_paging($skin_dir="", $bo_table, $url, $page=1, $page_name="page", $rows=2, $subject_len=40, $write_page= '', $total_count = '', $options="",$sca="", $sfl = "", $stx="", $stx_wr_1="", $stx_wr_2="", $stx_wr_3="", $stx_wr_4="", $stx_wr_5="", $stx_wr_6="", $stx_wr_7="", $stx_wr_8="", $stx_wr_9="", $stx_wr_10="")
{
global $g4, $config;
function latest_paging($skin_dir="", $bo_table, $url, $page=1, $page_name="page", $rows=2, $subject_len=40, $write_page= '', $total_count = '', $options="",$sca="", $sfl = "", $stx="", $stx_wr_1="", $stx_wr_2="", $stx_wr_3="", $stx_wr_4="", $stx_wr_5="", $stx_wr_6="", $stx_wr_7="", $stx_wr_8="", $stx_wr_9="", $stx_wr_10="")
{
global $g4, $config;
if ($skin_dir)
$GLOBALS['latest_skin_path'] = $latest_skin_path = "{$g4['path']}/skin/latest/$skin_dir";
else
$GLOBALS['latest_skin_path'] = $latest_skin_path = "{$g4['path']}/skin/latest/basic";
$GLOBALS['latest_skin_path'] = $latest_skin_path = "{$g4['path']}/skin/latest/$skin_dir";
else
$GLOBALS['latest_skin_path'] = $latest_skin_path = "{$g4['path']}/skin/latest/basic";
$list = array();
$sql_search = "";
$sql_search = "";
$sql = " select * from {$g4['board_table']} where bo_table = '$bo_table'";
$board = sql_fetch($sql);
$board = sql_fetch($sql);
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
if ($sca || $stx || $stx_wr_1 || $stx_wr_2 || $stx_wr_3 || $stx_wr_4 || $stx_wr_5 || $stx_wr_6 || $stx_wr_7 || $stx_wr_8 || $stx_wr_9 || $stx_wr_10)
{
$sql_search = get_sql_search($sca, $stx_wr_1, $stx_wr_2, $stx_wr_3, $stx_wr_4, $stx_wr_5, $stx_wr_6, $stx_wr_7, $stx_wr_8, $stx_wr_9, $stx_wr_10, $sfl, $stx, $sop);
$sql_search = "and ".$sql_search;
}
{
$sql_search = get_sql_search($sca, $stx_wr_1, $stx_wr_2, $stx_wr_3, $stx_wr_4, $stx_wr_5, $stx_wr_6, $stx_wr_7, $stx_wr_8, $stx_wr_9, $stx_wr_10, $sfl, $stx, $sop);
$sql_search = "and ".$sql_search;
}
if($total_count == "")
{
$sql = sql_fetch(" select count(*) as cnt, MIN(wr_num) as n_num, MAX(wr_num) as m_num from $tmp_write_table where wr_is_comment = 0 AND INSTR('$board[bo_notice]', wr_id)<1 $sql_search order by wr_num");
$total_count = $sql[cnt];
$min_number = $sql[n_num];
$max_number = $sql[m_num];
} else {
$sql = sql_fetch(" select count(*) as cnt, MIN(wr_num) as n_num from $tmp_write_table where wr_is_comment = 0 AND INSTR('$board[bo_notice]', wr_id)<1 $sql_search order by wr_num limit 0, $total_count");
$min_number = $sql[n_num];
$max_number = $sql[n_num] + $total_count;
}
{
$sql = sql_fetch(" select count(*) as cnt, MIN(wr_num) as n_num, MAX(wr_num) as m_num from $tmp_write_table where wr_is_comment = 0 AND INSTR('$board[bo_notice]', wr_id)<1 $sql_search order by wr_num");
$total_count = $sql[cnt];
$min_number = $sql[n_num];
$max_number = $sql[m_num];
} else {
$sql = sql_fetch(" select count(*) as cnt, MIN(wr_num) as n_num from $tmp_write_table where wr_is_comment = 0 AND INSTR('$board[bo_notice]', wr_id)<1 $sql_search order by wr_num limit 0, $total_count");
$min_number = $sql[n_num];
$max_number = $sql[n_num] + $total_count;
}
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if (!$page) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
if (!$page) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
// 게시물 구해오기
$sql = " select * from $tmp_write_table where wr_is_comment = 0 AND INSTR('$board[bo_notice]', wr_id)<1 $sql_search AND (wr_num between '".$min_number."' and '".$max_number."') order by wr_num limit $from_record, $rows ";
$sql = " select * from $tmp_write_table where wr_is_comment = 0 AND INSTR('$board[bo_notice]', wr_id)<1 $sql_search AND (wr_num between '".$min_number."' and '".$max_number."') order by wr_num limit $from_record, $rows ";
//explain($sql);
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++) {
$list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
}
if(strstr($url, "?")) {
$connect = "&";
} else {
$connect = "?";
}
$connect = "&";
} else {
$connect = "?";
}
$write_pages = get_paging($write_page, $page, $total_page, $url.$connect.$page_name."=");
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>
}
?>
답변을 작성하시기 전에 로그인 해주세요.