최신 겔러리 공지겔러리 먼저출력
최신겔러리에 공지겔러리 있으면 공지겔러리먼저 출력하고 다음 일반겔러리를 출력할려면...
latest,lib 파일은 수정할수 없구요. 랜덤을 포함한 다른 함수가 들어있어서....
어떻게 하면 될까요?
겔러리 최신글 스킨 거의 다 받아서 테스트 해봤지만 공지겔러리를 먼저 출력하는 최신게시물 스킨은 없는거 같아요.
혹시 latest,lib 파일에 공지도 먼저 출력할수 있도록 수정가능할까요?
아래는 제가 사용중인 latest,lib 파일입니다.
$options 에 따라서 랜덤이나 조회순 추천순으로 최신글을 출력합니다.
<?
if (!defined('_GNUBOARD_')) exit;
// 최신글 추출
function latest($skin_dir="", $bo_table, $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_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 order by wr_id desc limit 0, $rows ";
// 위의 코드 보다 속도가 빠름
if ($options == "H") // 넘어온 값이 "H" 즉 hit 일때
$options = "wr_hit"; // hit 순으로 쿼리
elseif ($options == "C") // 넘어온 값이 "C" 즉 comment 일때
$options ="wr_comment"; // comment 순으로 쿼리
elseif ($options == "R") //넘온값이 "R" 즉 random 일때
$options = "rand()"; // 랜덤 쿼리
elseif ($options == "G") //넘온값이 "G" 즉 추천 일때
$options = "wr_good"; // 추천 쿼리
else // 넘어온값이 없거나 그이외 일때
$options = "wr_id"; // 걍 최근순으로 쿼리
$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by $options desc limit 0, $rows ";
// $sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_num 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,lib 파일은 수정할수 없구요. 랜덤을 포함한 다른 함수가 들어있어서....
어떻게 하면 될까요?
겔러리 최신글 스킨 거의 다 받아서 테스트 해봤지만 공지겔러리를 먼저 출력하는 최신게시물 스킨은 없는거 같아요.
혹시 latest,lib 파일에 공지도 먼저 출력할수 있도록 수정가능할까요?
아래는 제가 사용중인 latest,lib 파일입니다.
$options 에 따라서 랜덤이나 조회순 추천순으로 최신글을 출력합니다.
<?
if (!defined('_GNUBOARD_')) exit;
// 최신글 추출
function latest($skin_dir="", $bo_table, $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_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 order by wr_id desc limit 0, $rows ";
// 위의 코드 보다 속도가 빠름
if ($options == "H") // 넘어온 값이 "H" 즉 hit 일때
$options = "wr_hit"; // hit 순으로 쿼리
elseif ($options == "C") // 넘어온 값이 "C" 즉 comment 일때
$options ="wr_comment"; // comment 순으로 쿼리
elseif ($options == "R") //넘온값이 "R" 즉 random 일때
$options = "rand()"; // 랜덤 쿼리
elseif ($options == "G") //넘온값이 "G" 즉 추천 일때
$options = "wr_good"; // 추천 쿼리
else // 넘어온값이 없거나 그이외 일때
$options = "wr_id"; // 걍 최근순으로 쿼리
$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by $options desc limit 0, $rows ";
// $sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_num 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;
}
?>
|
댓글을 작성하시려면 로그인이 필요합니다.
댓글 1개
latest 함수를 하나 더 만들면 될텐데?
이해가 안되네요