카테고리별 최근게시물 글번호 출력
본문
카테고리별로 최근게시물 출력하는 스킨에서
글번호출력이 전체 게시물에서 카운트 됩니다.
이부분 소스를 카테고리별로 글번호가 카운트되서 출력되도록 어떻게 바꾸나요 ㅠ
아래 출력부분 소스입니다. 답변 부탁드립니다. ㅠ
*최근게시물에서 불러오는 lib.php 소스 하단에 함께 추가하였습니다.
<? for ($i=0; $i<count($list); $i++) { ?>
.
.
<?
$num = $board[bo_count_write] - $i;
echo $num;
?>
.
.
<? } ?>
-------------lib.php-------------
<?
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;
}
?>
답변 1
아래 코드를 $num = ~~윗줄에 넣으세요
$row= sql_fetch("select count(*) as cnt from $tmp_write_table where ca_name = '{$list[0][ca_name]}'");
$board[bo_count_write] = $row[cnt];