2가지 질문입니다. 도와주세요..ㅡㅜ 정보
2가지 질문입니다. 도와주세요..ㅡㅜ본문
같은 그룹내에 세개의 게시판이 있는데 거기서 각기 5개씩의 최근사진을 불러와서 메인에 흐르게 하려 합니다.
일단 총 15개를 부르는데는 성공을 했습니다. 그런데...
1.아무리해도 게시판 세개에서 각기 5개씩 뽑는게 안되네요...
2. 메인에 흐르는순서를 board1,board2,board3으로 하고 싶은데...
<?
function latest_gr($skin_dir="", $gr_id, $rows=5, $subject_len=40)
{
{
global $config;
global $g4;
global $g4;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/$config[cf_latest_skin]";
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/$config[cf_latest_skin]";
$list = array();
$sql = " select a.*, b.bo_subject, c.gr_subject, c.gr_id
from $g4[board_new_table] a, $g4[board_table] b, $g4[group_table] c
where a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.gr_id = '$gr_id'
order by bo_table desc, bn_datetime desc limit 0, $rows ";
from $g4[board_new_table] a, $g4[board_table] b, $g4[group_table] c
where a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.gr_id = '$gr_id'
order by bo_table desc, bn_datetime desc limit 0, $rows ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$tmp_write_table = $g4[write_prefix] . $row[bo_table];
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$tmp_write_table = $g4[write_prefix] . $row[bo_table];
if ($row[wr_id] == $row[wr_parent]) // 원글
{
$comment = "";
$comment_link = "";
$row2 = sql_fetch(" select * from $tmp_write_table where wr_id = '$row[wr_id]' limit 5");
$list[$i] = $row2;
{
$comment = "";
$comment_link = "";
$row2 = sql_fetch(" select * from $tmp_write_table where wr_id = '$row[wr_id]' limit 5");
$list[$i] = $row2;
$name = get_sideview($row2[mb_id], cut_str($row2[wr_name], $config[cf_cut_name]), $row2[wr_email], $row2[wr_homepage]);
// 당일인 경우 시간으로 표시함
$datetime = substr($row2[wr_datetime],0,10);
$datetime2 = $row2[wr_datetime];
if ($datetime == $g4[time_ymd])
$datetime2 = substr($datetime2,11,5);
else
$datetime2 = substr($datetime2,5,5);
// 당일인 경우 시간으로 표시함
$datetime = substr($row2[wr_datetime],0,10);
$datetime2 = $row2[wr_datetime];
if ($datetime == $g4[time_ymd])
$datetime2 = substr($datetime2,11,5);
else
$datetime2 = substr($datetime2,5,5);
}
$list[$i][gr_id] = $row[gr_id];
$list[$i][bo_table] = $row[bo_table];
$list[$i][name] = $name;
$list[$i][comment] = $comment;
$list[$i][href] = "./board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]{$comment_link}";
$list[$i][datetime] = $datetime;
$list[$i][datetime2] = $datetime2;
$list[$i][bo_table] = $row[bo_table];
$list[$i][name] = $name;
$list[$i][comment] = $comment;
$list[$i][href] = "./board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]{$comment_link}";
$list[$i][datetime] = $datetime;
$list[$i][datetime2] = $datetime2;
$list[$i][gr_subject] = $row[gr_subject];
$list[$i][bo_subject] = $row[bo_subject];
$list[$i][wr_subject] = $row2[wr_subject];
$list[$i][bo_subject] = $row[bo_subject];
$list[$i][wr_subject] = $row2[wr_subject];
}
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
}
?>
댓글 전체
>1.아무리해도 게시판 세개에서 각기 5개씩 뽑는게 안되네요...
게시판에 글이 5개이상 있어야 5개가 나올텐데 5개 이하이면 있는것 모두 나옵니다.
>2. 메인에 흐르는순서를 board1,board2,board3으로 하고 싶은데...
다음의 order by 부분을 변경해보세요.
기존 : order by bo_table desc, bn_datetime desc limit 0, $rows ";
수정 : order by bo_table limit 0, $rows ";
게시판에 글이 5개이상 있어야 5개가 나올텐데 5개 이하이면 있는것 모두 나옵니다.
>2. 메인에 흐르는순서를 board1,board2,board3으로 하고 싶은데...
다음의 order by 부분을 변경해보세요.
기존 : order by bo_table desc, bn_datetime desc limit 0, $rows ";
수정 : order by bo_table limit 0, $rows ";
>1.아무리해도 게시판 세개에서 각기 5개씩 뽑는게 안되네요...
게시판에 글이 5개이상 있어야 5개가 나올텐데 5개 이하이면 있는것 모두 나옵니다.
====> 문제는 게시물이 5개이상이 되는 경우 세가지 게시판의 게시물이 각기 5개식 나오지 않는다는데 있어요..ㅡㅜ
어떤 게시판은 7개,어떤 게시판은 3개...
제가 원하는건 게시판의 게시물이 5개 이상인경우 각기 5개씩 15개를 흐르게 하는겁니다..
>2. 메인에 흐르는순서를 board1,board2,board3으로 하고 싶은데...
다음의 order by 부분을 변경해보세요.
기존 : order by bo_table desc, bn_datetime desc limit 0, $rows ";
수정 : order by bo_table limit 0, $rows ";
========================>말씀처럼 order by bo_table limit 0, $rows "; 로ㅗ 해봤었는데요..
그경우엔 게시물의 출력이 최근게시물이 아니라 제일 먼저 올린 게시물이 5개가 흘러서요..ㅡㅜ
게시판에 글이 5개이상 있어야 5개가 나올텐데 5개 이하이면 있는것 모두 나옵니다.
====> 문제는 게시물이 5개이상이 되는 경우 세가지 게시판의 게시물이 각기 5개식 나오지 않는다는데 있어요..ㅡㅜ
어떤 게시판은 7개,어떤 게시판은 3개...
제가 원하는건 게시판의 게시물이 5개 이상인경우 각기 5개씩 15개를 흐르게 하는겁니다..
>2. 메인에 흐르는순서를 board1,board2,board3으로 하고 싶은데...
다음의 order by 부분을 변경해보세요.
기존 : order by bo_table desc, bn_datetime desc limit 0, $rows ";
수정 : order by bo_table limit 0, $rows ";
========================>말씀처럼 order by bo_table limit 0, $rows "; 로ㅗ 해봤었는데요..
그경우엔 게시물의 출력이 최근게시물이 아니라 제일 먼저 올린 게시물이 5개가 흘러서요..ㅡㅜ
같은 그룹내에 세개의 게시판이 있는데 거기서 각기 5개씩의 최근사진을 불러와서 메인에 흐르게 하려 합니다.
1) 각 게시판에서 최근 게시물 5개를 추출하는 쿼리를 세 번하는 것이 간단하지 않나요?
결과를 배열로 저장하고,
2) 메인에 이미지 슬라이드 형태로 표현한다면...
검색 결과가 저장된 배열을 이용하면 어떨까요.
1) 각 게시판에서 최근 게시물 5개를 추출하는 쿼리를 세 번하는 것이 간단하지 않나요?
결과를 배열로 저장하고,
2) 메인에 이미지 슬라이드 형태로 표현한다면...
검색 결과가 저장된 배열을 이용하면 어떨까요.