이전 다음 검색 버튼 출력되지 않는 오류 수정

This commit is contained in:
chicpro
2014-09-03 11:16:06 +09:00
parent 7b1a7fd20e
commit 5cb4415032
2 changed files with 21 additions and 11 deletions

View File

@ -195,16 +195,20 @@ $next_part_href = '';
if ($sca || $stx) {
$list_href = './board.php?bo_table='.$bo_table;
$patterns = array('#&page=[0-9]*#', '#&spt=[0-9\-]*#');
//if ($prev_spt >= $min_spt)
$prev_spt = $spt - $config['cf_search_part'];
if (isset($min_spt) && $prev_spt >= $min_spt) {
$prev_part_href = './board.php?bo_table='.$bo_table.$qstr.'&spt='.$prev_spt.'&page=1';
$qstr1 = preg_replace($patterns, '', $qstr);
$prev_part_href = './board.php?bo_table='.$bo_table.$qstr1.'&spt='.$prev_spt.'&page=1';
$write_pages = page_insertbefore($write_pages, '<a href="'.$prev_part_href.'" class="pg_page pg_prev">이전검색</a>');
}
$next_spt = $spt + $config['cf_search_part'];
if ($next_spt < 0) {
$next_part_href = './board.php?bo_table='.$bo_table.$qstr.'&amp;spt='.$next_spt.'&amp;page=1';
$qstr1 = preg_replace($patterns, '', $qstr);
$next_part_href = './board.php?bo_table='.$bo_table.$qstr1.'&amp;spt='.$next_spt.'&amp;page=1';
$write_pages = page_insertafter($write_pages, '<a href="'.$next_part_href.'" class="pg_page pg_end">다음검색</a>');
}
}

View File

@ -54,21 +54,27 @@ function get_paging($write_pages, $cur_page, $total_page, $url, $add="")
return "";
}
// 페이징 코드의 <div><span> 태그 다음에 코드를 삽입
// 페이징 코드의 <nav><span> 태그 다음에 코드를 삽입
function page_insertbefore($paging_html, $insert_html)
{
if ($paging_html) {
return preg_replace("/^(<div[^>]+><span[^>]+>)/", '$1'.$insert_html, $paging_html);
}
if(!$paging_html)
$paging_html = '<nav class="pg_wrap"><span class="pg"></span></nav>';
return preg_replace("/^(<nav[^>]+><span[^>]+>)/", '$1'.$insert_html.PHP_EOL, $paging_html);
}
// 페이징 코드의 </span></div> 태그 이전에 코드를 삽입
// 페이징 코드의 </span></nav> 태그 이전에 코드를 삽입
function page_insertafter($paging_html, $insert_html)
{
if ($paging_html) {
//return preg_replace("/(<\/span><\/div>)$/", $insert_html.'$1', $paging_html);
return preg_replace("#(</span></div>)$#", $insert_html.'$1', $paging_html);
}
if(!$paging_html)
$paging_html = '<nav class="pg_wrap"><span class="pg"></span></nav>';
if(preg_match("#".PHP_EOL."</span></nav>#", $paging_html))
$php_eol = '';
else
$php_eol = PHP_EOL;
return preg_replace("#(</span></nav>)$#", $php_eol.$insert_html.'$1', $paging_html);
}
// 변수 또는 배열의 이름과 값을 얻어냄. print_r() 함수의 변형