카테고리 도움요청합니다!! 정보
카테고리 도움요청합니다!!본문
<? //여기부터
if (!defined('_GNUBOARD_')) exit;
if (!defined('_GNUBOARD_')) exit;
// 특정 카테고리 추출
function latest_cate($skin_dir="", $bo_table, $rows=10, $subject_len=40, $ca_name) // latest_cate <-요 문구 주목
{
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);
function latest_cate($skin_dir="", $bo_table, $rows=10, $subject_len=40, $ca_name) // latest_cate <-요 문구 주목
{
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; // 게시판 테이블 전체이름
$sql = " select * from $tmp_write_table where wr_is_comment = 0 and ca_name = '$ca_name' order by wr_id asc limit 0, $rows ";
//explain($sql);
$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();
$sql = " select * from $tmp_write_table where wr_is_comment = 0 and ca_name = '$ca_name' order by wr_id asc limit 0, $rows ";
//explain($sql);
$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;
} //여기까지 ?>
} //여기까지 ?>
---------------------------------
위소스는 팁란에서 구한건데요 페이지를 잊어먹어서 작성자이름을 까먹었네요..
제가 도움을 필요한 이유는 위소스는 카테고리별로 최근게시물을 불러올수 있는 소스입니다.
<?=latest_cate("최신게시물스킨", "게시판이름", 갯수, 제목길이,"카테고리")?>
이렇게 작동됩니다.
저는 카테고리 한개가 아니라 원하는 카테고리 몇개를 묶어서 불러오고싶습니다.
실력있으신 고수님들 부디 도와주세요!!
댓글 전체
도와주세요ㅠㅠ
아래 코드로 해보십시오.
<? //여기부터
if (!defined('_GNUBOARD_')) exit;
// 특정 카테고리 추출
function latest_cate($skin_dir="", $bo_table, $rows=10, $subject_len=40, $ca_name) // latest_cate <-요 문구 주목
{
global $g4;
$arry = explode(',', $ca_name);
$ca_name = trim($arry[0]);
$sql_cate = " and (ca_name = '$ca_name' ";
for ($i=1; $i<count($arry); $i++)
{
$ca_name = trim($arry[$i]);
$sql_cate .= " or ca_name = '$ca_name' ";
}
$sql_cate .= ")";
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; // 게시판 테이블 전체이름
$sql = " select * from $tmp_write_table where wr_is_comment = 0 $sql_cate order by wr_id asc limit 0, $rows ";
//explain($sql);
$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;
} //여기까지 ?>
사용법은 아래와 같습니다.
<?=latest_cate("최신게시물스킨", "게시판이름", 갯수, 제목길이,"카테고리1,카테고리2,카테고리3")?>
<? //여기부터
if (!defined('_GNUBOARD_')) exit;
// 특정 카테고리 추출
function latest_cate($skin_dir="", $bo_table, $rows=10, $subject_len=40, $ca_name) // latest_cate <-요 문구 주목
{
global $g4;
$arry = explode(',', $ca_name);
$ca_name = trim($arry[0]);
$sql_cate = " and (ca_name = '$ca_name' ";
for ($i=1; $i<count($arry); $i++)
{
$ca_name = trim($arry[$i]);
$sql_cate .= " or ca_name = '$ca_name' ";
}
$sql_cate .= ")";
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; // 게시판 테이블 전체이름
$sql = " select * from $tmp_write_table where wr_is_comment = 0 $sql_cate order by wr_id asc limit 0, $rows ";
//explain($sql);
$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;
} //여기까지 ?>
사용법은 아래와 같습니다.
<?=latest_cate("최신게시물스킨", "게시판이름", 갯수, 제목길이,"카테고리1,카테고리2,카테고리3")?>
최고에요 원더풀 엑설런트 따봉 와타시노 우레시이 데스 스고이!! 스바라시!!
order by wr_id asc 를 order by wr_id desc 로 변경하십시오.
다중카테고리 불러오는 법인가요?
저도 한번 해봐야 겠네요..^^
저도 한번 해봐야 겠네요..^^
다중 카테고리 불러오기