케

여러 게시판(테이블)에서 최신글 한번에 가져오기.

· 2012-05-02 (수) 10:39:47 · 10084 · 7
기존 q&a 보니 보드정보를 넘기지 않아서 이미지를 못가져오는 에러가 있었습니다.

각 게시물 보드정보도 넘기고 소스도 정리해 보았습니다.

$bo_table1,$bo_table2,$bo_table3,$bo_table4 파라미터 갯수는 알맞게 사용하세요.

그누보드홈/lib/latest.lib.php 에 추가

-------------------------------------------------------------------------------------------------------

// 최신글 추출 (다중 테이블)
function latest_multi($skin_dir="", $bo_table1,$bo_table2,$bo_table3,$bo_table4, $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')
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;
}
|

댓글 7개

오오 좋네여
2012-05-29 (화) 16:37:44
굿굿
2012-06-19 (화) 03:13:07
감사합니다
2013-01-03 (목) 16:31:49
감사합니다.
정말 고맙습니다. 굿굿~
2013-03-05 (화) 17:14:18
사용법이 어떻게 되나요 ㅠㅠ 답변부탁드립니다.. ㅠㅠ
감사합니다
댓글을 작성하시려면 로그인이 필요합니다.

그누4 팁자료실

3,309건

그누보드4와 관련된 팁을 여러분들과 함께 공유하세요. 나누면 즐거움이 커집니다.

+
제목 글쓴이 날짜 조회
12-06-08 조회 1.3만
12-06-08 조회 4,362
12-06-07 조회 2.5만
12-06-06 조회 8,211
12-06-04 조회 4,872
12-05-25 조회 9,111
12-05-24 조회 5,718
12-05-17 조회 7,264
12-05-16 조회 4,659
12-05-16 조회 5,940
12-05-16 조회 1만
12-05-14 조회 4,566
12-05-14 조회 4,400
12-05-09 조회 8,404
12-05-03 조회 5,291
12-05-02 조회 4,092
12-05-02 조회 1만
12-05-01 조회 6,808
12-04-28 조회 9,784
12-04-27 조회 7,484