다중게시판 최신글 추출문의 정보
다중게시판 최신글 추출문의
본문
안녕하세요........ 아래는 다중게시판에서 최신글을 추출하기위해 넣은 코드인데요.
추출된 게시물의 제목 앞에 게시판이름을 넣고 싶습니다. 영문 테이블명이 아니라 한글명요....
$bo_subject 이거요 ^^;;
// 최신글 추출 (다중 테이블)
function latest_multi_8($skin_dir="", $bo_table1,$bo_table2,$bo_table3,$bo_table4,$bo_table5,$bo_table6,$bo_table7,$bo_table8, $rows=10, $subject_len=40, $options="")
{
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_new_table] a, $g4[board_table] b
where a.bo_table = b.bo_table
and a.bo_table in('$bo_table1', '$bo_table2', '$bo_table3', '$bo_table4', '$bo_table5', '$bo_table6', '$bo_table7', '$bo_table8')
and a.wr_id = a.wr_parent
order by a.bn_id desc
limit $rows ";
$result = sql_query($sql);
for ($i=0; $board=sql_fetch_array($result); $i++)
{
$tmp_write_table = $g4[write_prefix] . $board[bo_table];
$sql = "select * from $tmp_write_table where wr_id = '$board[wr_id]'";
$result2 = sql_query($sql);
$row2 = sql_fetch_array($result2);
$list[$i] = get_list($row2, $board, $latest_skin_path, $subject_len);
$list[$i][bo_table] = $board[bo_table];
}
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
어딜 수정해야할까요?
추출된 게시물의 제목 앞에 게시판이름을 넣고 싶습니다. 영문 테이블명이 아니라 한글명요....
$bo_subject 이거요 ^^;;
// 최신글 추출 (다중 테이블)
function latest_multi_8($skin_dir="", $bo_table1,$bo_table2,$bo_table3,$bo_table4,$bo_table5,$bo_table6,$bo_table7,$bo_table8, $rows=10, $subject_len=40, $options="")
{
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_new_table] a, $g4[board_table] b
where a.bo_table = b.bo_table
and a.bo_table in('$bo_table1', '$bo_table2', '$bo_table3', '$bo_table4', '$bo_table5', '$bo_table6', '$bo_table7', '$bo_table8')
and a.wr_id = a.wr_parent
order by a.bn_id desc
limit $rows ";
$result = sql_query($sql);
for ($i=0; $board=sql_fetch_array($result); $i++)
{
$tmp_write_table = $g4[write_prefix] . $board[bo_table];
$sql = "select * from $tmp_write_table where wr_id = '$board[wr_id]'";
$result2 = sql_query($sql);
$row2 = sql_fetch_array($result2);
$list[$i] = get_list($row2, $board, $latest_skin_path, $subject_len);
$list[$i][bo_table] = $board[bo_table];
}
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
어딜 수정해야할까요?
댓글 전체
간단하게 select문을 하나 더 넣으면 해결 될 듯 보입니다.
$bo_table값 자체가 게시판의 primrary_key이기 때문에,
$result3 = sql_fetch("select *from g4_board where bo_table = '$bo_table'");
이걸 for안에 넣고
$list[$i][bo_subject] = $result3['bo_suject']
이렇게 넣고
문자열 스트림을 스택을 쌓는 함수 ob_start() 바로 아래
인클루드 된 lastest.skin.php에 가서
해당 부분을 echo 해주면 간단히 해결 될 거 같습니다.
$bo_table값 자체가 게시판의 primrary_key이기 때문에,
$result3 = sql_fetch("select *from g4_board where bo_table = '$bo_table'");
이걸 for안에 넣고
$list[$i][bo_subject] = $result3['bo_suject']
이렇게 넣고
문자열 스트림을 스택을 쌓는 함수 ob_start() 바로 아래
인클루드 된 lastest.skin.php에 가서
해당 부분을 echo 해주면 간단히 해결 될 거 같습니다.
쿼리 부분 변수가 잘못 되었네요. $bo_table -> $board[bo_table]이렇게 변수 수정해주시면 되요.

이미 다된밥에 숫가락만 얹어봅니다.
어차피 게시판명만 필요하실거니 * 보다는 bo_subject 만 뽑으시는게......
$result3 = sql_fetch("select bo_subject from g4_board where bo_table = '$board[bo_table]'");
어차피 게시판명만 필요하실거니 * 보다는 bo_subject 만 뽑으시는게......
$result3 = sql_fetch("select bo_subject from g4_board where bo_table = '$board[bo_table]'");