최신글 페이징 기능넣기 > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

최신글 페이징 기능넣기 정보

최신글 페이징 기능넣기

본문

아래 소스에 페이징 소스를 추가하고 싶습니다.

latest.skin.php파일에는
<div id="pagingNew"><?=$write_pages?></div>페이징소스 삽입

불러올 위치에서는 아래 소스로 불러옵니다.
<?
include_once("$g4[path]/skin/latest/GSG.GALLERY/inc_lib.php");
echo latest_cate("blog", "IDEA", 3, 20, "카테고리");
?>
=======================================
여기에 페이징 기능을 삽입하고 싶습니다.
<?
if (!defined('_GNUBOARD_')) exit;

function latest_cate($skin_dir="", $bo_table, $rows=10, $subject_len=40, $ca_name="")
{
    global $g4;

    if ($skin_dir)
        $latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
    else
        $latest_skin_path = "$g4[path]/skin/latest/basic";

    $list = array();

    $sql = " select * from $g4[board_table] where bo_table = '$bo_table'";
    $board = sql_fetch($sql);

    $tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름

    if ($ca_name)
    $sql = " select * from $tmp_write_table where ca_name = '$ca_name' and wr_is_comment = 0 order by wr_num limit 0, $rows ";
    else
    $sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_num limit 0, $rows ";
   
    $result = sql_query($sql);
    for ($i=0; $row = sql_fetch_array($result); $i++)
        $list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
   
    ob_start();
    include "$latest_skin_path/latest.skin.php";
    $content = ob_get_contents();
    ob_end_clean();

    return $content;
}

?>

Fatal error: Uncaught TypeError: mysqli_fetch_assoc(): Argument #1 ($result) must be of type mysqli_result, null given in /home/kagla/new-sir/old/lib/common.lib.php:2339 Stack trace: #0 /home/kagla/new-sir/old/lib/common.lib.php(2339): mysqli_fetch_assoc() #1 /home/kagla/new-sir/old/skin/board/v16/view.skin.php(795): sql_fetch_array() #2 /home/kagla/new-sir/old/bbs/view.php(403): include_once('...') #3 /home/kagla/new-sir/old/bbs/board.php(300): include_once('...') #4 {main} thrown in /home/kagla/new-sir/old/lib/common.lib.php on line 2339