그룹 불러내기 질문드립니다. 정보
그룹 불러내기 질문드립니다.본문
<?
$sql_common = " from $g4[group_table]";
$sql_search = " where (1)";
$sql_order = " order by gr_id asc";
$sql = "select count(*) as cnt $sql_common $sql_search $sql_order";
$row = sql_fetch($sql);
$sql = " select * $sql_common $sql_search $sql_order ";
$result = sql_query($sql);
echo "<table cellpadding=0 cellspacing=3>";
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$list = $i%2;
echo "<tr><td><a href='$g4[bbs_path]/group.php?gr_id=$row[gr_id]'>$row[gr_subject] - $row[gr_id]</a></td></tr>";
}
echo "</table>";
{}?>
하얀 님의 이 소스를 사용하면 그룹 목록들이 불러와 지는데
특정 그룹을 제외하려면 어떻게 해야 할까요?
혹시나 해서 $sql_common = " from $g4[group_table]"; 를
$sql_common = " from $g4[group_table]"
and ((
a.bo_table != 'ap_com' and
a.bo_table != 'ap_db'
)));)
이렇게 변경해 주었는데 안 되더라구요 T_T
다른 소스에 이런게 있길래.. ^^;
어떻게 하면 특정 게시판을 제외시킬 수 있을까요?
//$sql3 = " select bo_count_write from $cfg[table_board] where bo_table='$row2[bo_table]' order by bo_count_write ";
//$result3 = sql_query($sql3);
for ($j=0;$row2 = mysql_fetch_array($result2); $j++) {
$bo_sub=cut_str(get_text($row2[bo_subject]),28,"");
$co=$row2[bo_count_write];
$k++;
$l++;//게시판앞에 숫자 보이기 $bo_sub 앞에 $l을 넣어주면 숫자가 증가되면서 보임.
if($row2[bo_table]==clip){}// 특정게시판제외(여기서는 게시판명==clip)...
else{ echo "
이런 소스가 있던데..
G3용이라서 적용이 안되는 것 같더라구요 ㅠㅠ
도움 말씀 부탁드립니다!
그리고 하나 덧붙여서 그룹명 옆에 게시물수를 추가하려면 어떻게 해야 할까요?
$sql_common = " from $g4[group_table]";
$sql_search = " where (1)";
$sql_order = " order by gr_id asc";
$sql = "select count(*) as cnt $sql_common $sql_search $sql_order";
$row = sql_fetch($sql);
$sql = " select * $sql_common $sql_search $sql_order ";
$result = sql_query($sql);
echo "<table cellpadding=0 cellspacing=3>";
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$list = $i%2;
echo "<tr><td><a href='$g4[bbs_path]/group.php?gr_id=$row[gr_id]'>$row[gr_subject] - $row[gr_id]</a></td></tr>";
}
echo "</table>";
{}?>
하얀 님의 이 소스를 사용하면 그룹 목록들이 불러와 지는데
특정 그룹을 제외하려면 어떻게 해야 할까요?
혹시나 해서 $sql_common = " from $g4[group_table]"; 를
$sql_common = " from $g4[group_table]"
and ((
a.bo_table != 'ap_com' and
a.bo_table != 'ap_db'
)));)
이렇게 변경해 주었는데 안 되더라구요 T_T
다른 소스에 이런게 있길래.. ^^;
어떻게 하면 특정 게시판을 제외시킬 수 있을까요?
//$sql3 = " select bo_count_write from $cfg[table_board] where bo_table='$row2[bo_table]' order by bo_count_write ";
//$result3 = sql_query($sql3);
for ($j=0;$row2 = mysql_fetch_array($result2); $j++) {
$bo_sub=cut_str(get_text($row2[bo_subject]),28,"");
$co=$row2[bo_count_write];
$k++;
$l++;//게시판앞에 숫자 보이기 $bo_sub 앞에 $l을 넣어주면 숫자가 증가되면서 보임.
if($row2[bo_table]==clip){}// 특정게시판제외(여기서는 게시판명==clip)...
else{ echo "
이런 소스가 있던데..
G3용이라서 적용이 안되는 것 같더라구요 ㅠㅠ
도움 말씀 부탁드립니다!
그리고 하나 덧붙여서 그룹명 옆에 게시물수를 추가하려면 어떻게 해야 할까요?
댓글 전체
$sql_common = " from $g4[group_table]"
and ((
a.bo_table != 'ap_com' and
a.bo_table != 'ap_db'
)));)
이건 전체그룹에서 특정 테이블을 제외하는 것입니다.
특정그룹을 제외하는것은 아닙니다.
and ((
a.bo_table != 'ap_com' and
a.bo_table != 'ap_db'
)));)
이건 전체그룹에서 특정 테이블을 제외하는 것입니다.
특정그룹을 제외하는것은 아닙니다.
전체그룹에서
1방법:세세하게 특정게시판만 제외합니다.
2방법:특정그룹만 제외합니다.
3방법:특정그룹과 특정게시판을 같이 제외합니다.
4방법:특정그룹만 출력합니다.
5.응용방법
제1방법에서 제외할 특정그룹을 지정하지않고 특정게시판만 적어주고 제3방법에서 특정그룹을 선택하면
특정그룹에서 제외되지않는 게시판만 출력되겠죠?
5.한 화면에 특정수만큼 출력합니다.
6.먼저쓴글이 상단에 출력되는 오름차순이나 나중에 쓴글이 상단에 출력되는 내림차순을 선택합니다.
7.언마우스시 글내용을 말풍선으로 출력되거나...
이미지 일때 쏴주는..그런 좀 가공하는 부분은 좀 노력하는...각자가 노력하면 되겠네요.
bbs/new.php 전체입니다.
자~~알 읽어보시면 이해가 되실겁니다.
<?
include_once("./_common.php");
$g4[title] = "최근 게시물";
include_once("./_head.php");
if ($bo_table) {
$board_HIT = sql_fetch(" select * from $g4[board_table] where bo_table = '$bo_table' ");
if ($board[bo_table]) {
$gr_HIT = $board[wr_hit];
}
}
# bbs/new.php
##############################################################
# 전체 검색에서는 특정 테이블을 제외하는데 최신글을 bbs/group.php가 아니라 보드형으로
# bbs/new.php 처럼 리스트하는데 그 형식으로는 특정 게시판을 제외하고 싶은데...안되고
# 또 코멘트순,히트순으로 리스트하는 것은 특정 기간내에 사라지고 부분별로 나뉘어져 있다.???
# 맞나요...??
# 게시판 관리에서 '최신글에 목록보이기' ?? 그런 기능이 없다면
# 단순하게 삽질하는 방법에 이런 방법도 있긴 하겠는데요..글쎄요죠...;;
#
# bbs/new.php 를 보시면 7라인 쯤에 아래의 두 라인이 있습니다.
/*
$sql_common = " 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.bo_use_search = '1' ";
*/
#위의 두라인을 아래처럼 바꿉니다.
# 전체그룹에서 특정한 테이블만이 제외되는 방법입니다.
##############################################################
#아래처럼___//여기서부터
/* $sql_common = " 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.bo_use_search = '1')
and ((
a.bo_table != 'gb4_baedal_special' and
a.bo_table != 'gb4_baedal_free' and
a.bo_table != 'basic_test'
)))";
*/
# __________//여기까지를 위 처럼 바꾼후에
# a.bo_table !='이부분에 게시판관리시에 나타나는 빼고싶은 테이블을 삽입'and
# // 마지막엔 and 를 넣지 않습니다...
# 또 다른 방법은 특정한 그룹과 특정한 테이블을 같이 제외하는
# 방법입니다. 위의 두라인을 아래처럼 바꿔주시면 됩니다.
# 세세하게 전체그룹에서 특정 테이블만 제외하시고 싶으시면
# 테이블을제외하시고 특정그룹만 제외하려면 하시고...
##############################################################
$sql_common = " 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 != 'aaaa' and
b.gr_id != '제외할' and
b.gr_id != '그룹명' and
b.gr_id != '을점안에써넣어요'
)
)
and b.bo_use_search = '1')
and ((
a.bo_table != 'gb4_baedal_special' and
a.bo_table != '제외할' and
a.bo_table != '테이블명을' and
a.bo_table != '이처럼점안에써넣어요'))
)";
##############################################################
# 또 다른 방법
//위의 두 라인을 위 처럼 바꾸지않고
//특정한 그룹에서만 뽑자...특정한 그룹명에서만 뽑으려면 아래라인만 추가하면 됩니다.
//아래를 풀면 전체그룹에서 aaaa라는 그룹에서만 뽑아냅니다.
// $gr_id='aaaa';
#########################################
if ($gr_id) $sql_common .= " and b.gr_id = '$gr_id' ";
if ($view == "w") $sql_common .= " and a.wr_id = a.wr_parent ";
else if ($view == "c")
$sql_common .= " and a.wr_id <> a.wr_parent ";
// 먼저 등록된 글이 밀려나지 않고 제일위에?? 오름차순 말인가요?
// 그럼 아래처럼...내림차순
//$sql_order = "order by a.bn_id asc";
//나중에 쓴글이 제일 상단에..내림차순입니다. 디폴트로 내림차순.
$sql_order = "order by a.bn_id desc";
#########################################
//오다바이의 방법...테스트라인.
//$sql_order = "order by a.bn_id desc ";
//$sql_order = "order by b.gr_hit";
$sql = " select count(*) as cnt $sql_common ";
$row = sql_fetch($sql);
$total_count = $row[cnt];
$rows = $config[cf_new_rows];
#########################################
//한 화면에 강제로 100개씩 보여주자...자신이 원하는 만큼이죠.
//환경설정과 관련없고 아래를 막으면 환경설정대로되죠.
$rows=100;
#########################################
#2005.11.30 dalsoo
##############################################################
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if (!$page) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$group_select = "<select name=gr_id id=gr_id onchange='select_change();'><option value=''>전체그룹";
$sql = " select gr_id, gr_subject from $g4[group_table] order by gr_id ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$group_select .= "<option value='$row[gr_id]'>$row[gr_subject]";
}
$group_select .= "</select>";
$list = array();
$sql = " select a.*, b.bo_subject, c.gr_subject, c.gr_id
$sql_common
$sql_order
limit $from_record, $rows ";
$result = sql_query($sql);
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]'");
$row2 = sql_fetch(" select * from $tmp_write_table where wr_id = '$row[wr_id]' order by '$row[wr_hit]'");
$list[$i] = $row2;
$name = get_sideview($row2[mb_id], cut_str($row2[wr_name], $config[cf_cut_name]), $row2[wr_email], $row2[wr_homepage]);
//test step...추가
echo"<font coror='#006699'>
<b>tmp_테이블: </b>$tmp_write_table
<b>row2_HIT: </b><font color='red'>$row2[wr_hit]</font>
<b>row_wr_id :</b> $row[wr_id]
</font><br>";
// 당일인 경우 시간으로 표시함
$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);
}
else // 코멘트
{
$comment = "[코] ";
$comment_link = "#c_{$row[wr_id]}";
$row2 = sql_fetch(" select * from $tmp_write_table where wr_id = '$row[wr_parent]' ");
$row3 = sql_fetch(" select mb_id, wr_name, wr_email, wr_homepage, wr_datetime from $tmp_write_table where wr_id = '$row[wr_id]' ");
$list[$i] = $row2;
$list[$i][mb_id] = $row3[mb_id];
$list[$i][wr_name] = $row3[wr_name];
$list[$i][wr_email] = $row3[wr_email];
$list[$i][wr_homepage] = $row3[wr_homepage];
$name = get_sideview($row3[mb_id], cut_str($row3[wr_name], $config[cf_cut_name]), $row3[wr_email], $row3[wr_homepage]);
//test step...추가
//echo"<font coror='#006699'>$row3[wr_hit] </font>";
// 당일인 경우 시간으로 표시함
$datetime = substr($row3[wr_datetime],0,10);
$datetime2 = $row3[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][gr_subject] = $row[gr_subject];
$list[$i][bo_subject] = $row[bo_subject];
$list[$i][wr_subject] = $row2[wr_subject];
//추가
$list[$i][gr_wr_hit] = $row2[wr_hit];
}
$write_pages = get_paging($config[cf_write_pages], $page, $total_page, "?gr_id=$gr_id&view=$view&page=");
$new_skin_path = "$g4[path]/skin/new/$config[cf_new_skin]";
echo "<script language=\"javascript\" src=\"$g4[path]/js/sideview.js\"></script>\n";
include_once("$new_skin_path/new.skin.php");
include_once("./_tail.php");
?>
1방법:세세하게 특정게시판만 제외합니다.
2방법:특정그룹만 제외합니다.
3방법:특정그룹과 특정게시판을 같이 제외합니다.
4방법:특정그룹만 출력합니다.
5.응용방법
제1방법에서 제외할 특정그룹을 지정하지않고 특정게시판만 적어주고 제3방법에서 특정그룹을 선택하면
특정그룹에서 제외되지않는 게시판만 출력되겠죠?
5.한 화면에 특정수만큼 출력합니다.
6.먼저쓴글이 상단에 출력되는 오름차순이나 나중에 쓴글이 상단에 출력되는 내림차순을 선택합니다.
7.언마우스시 글내용을 말풍선으로 출력되거나...
이미지 일때 쏴주는..그런 좀 가공하는 부분은 좀 노력하는...각자가 노력하면 되겠네요.
bbs/new.php 전체입니다.
자~~알 읽어보시면 이해가 되실겁니다.
<?
include_once("./_common.php");
$g4[title] = "최근 게시물";
include_once("./_head.php");
if ($bo_table) {
$board_HIT = sql_fetch(" select * from $g4[board_table] where bo_table = '$bo_table' ");
if ($board[bo_table]) {
$gr_HIT = $board[wr_hit];
}
}
# bbs/new.php
##############################################################
# 전체 검색에서는 특정 테이블을 제외하는데 최신글을 bbs/group.php가 아니라 보드형으로
# bbs/new.php 처럼 리스트하는데 그 형식으로는 특정 게시판을 제외하고 싶은데...안되고
# 또 코멘트순,히트순으로 리스트하는 것은 특정 기간내에 사라지고 부분별로 나뉘어져 있다.???
# 맞나요...??
# 게시판 관리에서 '최신글에 목록보이기' ?? 그런 기능이 없다면
# 단순하게 삽질하는 방법에 이런 방법도 있긴 하겠는데요..글쎄요죠...;;
#
# bbs/new.php 를 보시면 7라인 쯤에 아래의 두 라인이 있습니다.
/*
$sql_common = " 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.bo_use_search = '1' ";
*/
#위의 두라인을 아래처럼 바꿉니다.
# 전체그룹에서 특정한 테이블만이 제외되는 방법입니다.
##############################################################
#아래처럼___//여기서부터
/* $sql_common = " 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.bo_use_search = '1')
and ((
a.bo_table != 'gb4_baedal_special' and
a.bo_table != 'gb4_baedal_free' and
a.bo_table != 'basic_test'
)))";
*/
# __________//여기까지를 위 처럼 바꾼후에
# a.bo_table !='이부분에 게시판관리시에 나타나는 빼고싶은 테이블을 삽입'and
# // 마지막엔 and 를 넣지 않습니다...
# 또 다른 방법은 특정한 그룹과 특정한 테이블을 같이 제외하는
# 방법입니다. 위의 두라인을 아래처럼 바꿔주시면 됩니다.
# 세세하게 전체그룹에서 특정 테이블만 제외하시고 싶으시면
# 테이블을제외하시고 특정그룹만 제외하려면 하시고...
##############################################################
$sql_common = " 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 != 'aaaa' and
b.gr_id != '제외할' and
b.gr_id != '그룹명' and
b.gr_id != '을점안에써넣어요'
)
)
and b.bo_use_search = '1')
and ((
a.bo_table != 'gb4_baedal_special' and
a.bo_table != '제외할' and
a.bo_table != '테이블명을' and
a.bo_table != '이처럼점안에써넣어요'))
)";
##############################################################
# 또 다른 방법
//위의 두 라인을 위 처럼 바꾸지않고
//특정한 그룹에서만 뽑자...특정한 그룹명에서만 뽑으려면 아래라인만 추가하면 됩니다.
//아래를 풀면 전체그룹에서 aaaa라는 그룹에서만 뽑아냅니다.
// $gr_id='aaaa';
#########################################
if ($gr_id) $sql_common .= " and b.gr_id = '$gr_id' ";
if ($view == "w") $sql_common .= " and a.wr_id = a.wr_parent ";
else if ($view == "c")
$sql_common .= " and a.wr_id <> a.wr_parent ";
// 먼저 등록된 글이 밀려나지 않고 제일위에?? 오름차순 말인가요?
// 그럼 아래처럼...내림차순
//$sql_order = "order by a.bn_id asc";
//나중에 쓴글이 제일 상단에..내림차순입니다. 디폴트로 내림차순.
$sql_order = "order by a.bn_id desc";
#########################################
//오다바이의 방법...테스트라인.
//$sql_order = "order by a.bn_id desc ";
//$sql_order = "order by b.gr_hit";
$sql = " select count(*) as cnt $sql_common ";
$row = sql_fetch($sql);
$total_count = $row[cnt];
$rows = $config[cf_new_rows];
#########################################
//한 화면에 강제로 100개씩 보여주자...자신이 원하는 만큼이죠.
//환경설정과 관련없고 아래를 막으면 환경설정대로되죠.
$rows=100;
#########################################
#2005.11.30 dalsoo
##############################################################
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if (!$page) $page = 1; // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$group_select = "<select name=gr_id id=gr_id onchange='select_change();'><option value=''>전체그룹";
$sql = " select gr_id, gr_subject from $g4[group_table] order by gr_id ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$group_select .= "<option value='$row[gr_id]'>$row[gr_subject]";
}
$group_select .= "</select>";
$list = array();
$sql = " select a.*, b.bo_subject, c.gr_subject, c.gr_id
$sql_common
$sql_order
limit $from_record, $rows ";
$result = sql_query($sql);
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]'");
$row2 = sql_fetch(" select * from $tmp_write_table where wr_id = '$row[wr_id]' order by '$row[wr_hit]'");
$list[$i] = $row2;
$name = get_sideview($row2[mb_id], cut_str($row2[wr_name], $config[cf_cut_name]), $row2[wr_email], $row2[wr_homepage]);
//test step...추가
echo"<font coror='#006699'>
<b>tmp_테이블: </b>$tmp_write_table
<b>row2_HIT: </b><font color='red'>$row2[wr_hit]</font>
<b>row_wr_id :</b> $row[wr_id]
</font><br>";
// 당일인 경우 시간으로 표시함
$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);
}
else // 코멘트
{
$comment = "[코] ";
$comment_link = "#c_{$row[wr_id]}";
$row2 = sql_fetch(" select * from $tmp_write_table where wr_id = '$row[wr_parent]' ");
$row3 = sql_fetch(" select mb_id, wr_name, wr_email, wr_homepage, wr_datetime from $tmp_write_table where wr_id = '$row[wr_id]' ");
$list[$i] = $row2;
$list[$i][mb_id] = $row3[mb_id];
$list[$i][wr_name] = $row3[wr_name];
$list[$i][wr_email] = $row3[wr_email];
$list[$i][wr_homepage] = $row3[wr_homepage];
$name = get_sideview($row3[mb_id], cut_str($row3[wr_name], $config[cf_cut_name]), $row3[wr_email], $row3[wr_homepage]);
//test step...추가
//echo"<font coror='#006699'>$row3[wr_hit] </font>";
// 당일인 경우 시간으로 표시함
$datetime = substr($row3[wr_datetime],0,10);
$datetime2 = $row3[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][gr_subject] = $row[gr_subject];
$list[$i][bo_subject] = $row[bo_subject];
$list[$i][wr_subject] = $row2[wr_subject];
//추가
$list[$i][gr_wr_hit] = $row2[wr_hit];
}
$write_pages = get_paging($config[cf_write_pages], $page, $total_page, "?gr_id=$gr_id&view=$view&page=");
$new_skin_path = "$g4[path]/skin/new/$config[cf_new_skin]";
echo "<script language=\"javascript\" src=\"$g4[path]/js/sideview.js\"></script>\n";
include_once("$new_skin_path/new.skin.php");
include_once("./_tail.php");
?>
답변 감사합니다. ^^
하지만 제가 올린 첫번째 소스는 웹페이지에서 구동이 되는데
new.php 소스를 적용하면 안되더라구요 T_T
하지만 제가 올린 첫번째 소스는 웹페이지에서 구동이 되는데
new.php 소스를 적용하면 안되더라구요 T_T

sss