카테고리 최신글 제목이 안나옵니다 정보
카테고리 최신글 제목이 안나옵니다본문
그누보드 / extend / hp.latest.php 로 파일을 만들어서 업로드합니다.
1. 최신글 랜덤으로 보이기
랜덤 추출 함수 rand() 활용
사용법 : <?=latest_rand("최신글스킨", "게시판이름", 게시물수, 제목글자수");?>
2. 카테고리로 최신글 보이기 # 2008-07-03 추가 , 2009-05-13 수정
사용법 : <?=latest_category("최신글스킨", "게시판이름", 게시물수, 제목글자수, "옵션", "카테고리이름");?>
3. 답글이 원본글 밑에 붙는 방식
사용법 : <?=latest_re("최신글스킨", "게시판이름", 게시물수, 제목글자수);?>
4. 작성일자로 최신글 추출 # 2008-07-03 추가
사용법 : <?=latest_datetime("최신글스킨", "게시판이름", 게시물수, 제목글자수);?>
<?
if (!defined('_GNUBOARD_')) exit;
// 최신글 랜덤 추출
function latest_rand($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 rand() desc 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;
}
// 최신글 카테고리 데이타만 추출
function latest_category ($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="", $category="") {
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 ca_name = '$category' 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;
}
// 최신글 추출 ## 답글이 원본글 밑에 붙는 방식
function latest_re($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_num asc, 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;
}
// 작성일자로 최신글 추출
function latest_datetime($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 ";
// 위의 코드 보다 속도가 빠름
$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_datetime desc 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;
}
?>
rand
(PHP 3, PHP 4 , PHP 5)
rand -- 정수형의 난수를 생성합니다.
설명
int rand ( [int min, int max])
부수적인 min, max 인수 없이 호출하면, rand()는 0과 RAND_MAX 사이의 임의의 난수를 반환합니다. 예를 들어, 5와 15(포함) 사이의 난수를 얻으려면, rand (5, 15)로 사용합니다.
<?=latest_category("com_01", "event_02", 5, 40, "", "이벤트");?> 이렇게 적용을 하면
이미미와 뎃글갯수와(2) 날짜만 나오고 제목이 안나옵니다
제목이 나오느것도 있구요...왜 그럴까요 고수님들의 많은 조언 부탁드립니다
1. 최신글 랜덤으로 보이기
랜덤 추출 함수 rand() 활용
사용법 : <?=latest_rand("최신글스킨", "게시판이름", 게시물수, 제목글자수");?>
2. 카테고리로 최신글 보이기 # 2008-07-03 추가 , 2009-05-13 수정
사용법 : <?=latest_category("최신글스킨", "게시판이름", 게시물수, 제목글자수, "옵션", "카테고리이름");?>
3. 답글이 원본글 밑에 붙는 방식
사용법 : <?=latest_re("최신글스킨", "게시판이름", 게시물수, 제목글자수);?>
4. 작성일자로 최신글 추출 # 2008-07-03 추가
사용법 : <?=latest_datetime("최신글스킨", "게시판이름", 게시물수, 제목글자수);?>
<?
if (!defined('_GNUBOARD_')) exit;
// 최신글 랜덤 추출
function latest_rand($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 rand() desc 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;
}
// 최신글 카테고리 데이타만 추출
function latest_category ($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="", $category="") {
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 ca_name = '$category' 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;
}
// 최신글 추출 ## 답글이 원본글 밑에 붙는 방식
function latest_re($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_num asc, 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;
}
// 작성일자로 최신글 추출
function latest_datetime($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 ";
// 위의 코드 보다 속도가 빠름
$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_datetime desc 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;
}
?>
rand
(PHP 3, PHP 4 , PHP 5)
rand -- 정수형의 난수를 생성합니다.
설명
int rand ( [int min, int max])
부수적인 min, max 인수 없이 호출하면, rand()는 0과 RAND_MAX 사이의 임의의 난수를 반환합니다. 예를 들어, 5와 15(포함) 사이의 난수를 얻으려면, rand (5, 15)로 사용합니다.
<?=latest_category("com_01", "event_02", 5, 40, "", "이벤트");?> 이렇게 적용을 하면
이미미와 뎃글갯수와(2) 날짜만 나오고 제목이 안나옵니다
제목이 나오느것도 있구요...왜 그럴까요 고수님들의 많은 조언 부탁드립니다
댓글 전체
/skin/latest/com_01/latest.skin.php 파일에서 제목출력부분 확인하세요
[이벤트] (22) [06-18]
[이벤트] 레알 이벤트 시… (12) [05-10]
[이벤트] (15) [06-17]
[이벤트] (6)
이런 식으로 나오는데요... 제목출력부분을 확인 하면..
[이벤트] 레알 이벤트 시… (12) [05-10]
[이벤트] (15) [06-17]
[이벤트] (6)
이런 식으로 나오는데요... 제목출력부분을 확인 하면..
echo $list[$i][icon_reply] . " ";
echo "<a href='{$list[$i][href]}'>";
if ($list[$i][is_notice])
echo "<font style='font-family:돋움; font-size:9pt; color:#281900;'>{$list[$i][subject]}</font>";
else
echo "<font style='font-family:돋움; font-size:9pt; color:#281900;'>[{$list[$i][ca_name]}] </font>";
echo "<font style='font-family:돋움; font-size:9pt; color:#281900;'>{$list[$i][subject]}</font>";
echo "</a>";
if ($list[$i][comment_cnt])
echo " <a href=\"{$list[$i][comment_href]}\"><span style='font-family:돋움; font-size:8pt; color:#281900;'>{$list[$i][comment_cnt]}</span></a>";
// if ($list[$i]['link']['count']) { echo "[{$list[$i]['link']['count']}]"; }
// if ($list[$i]['file']['count']) { echo "<{$list[$i]['file']['count']}>"; }
echo "<a href='{$list[$i][href]}'>";
if ($list[$i][is_notice])
echo "<font style='font-family:돋움; font-size:9pt; color:#281900;'>{$list[$i][subject]}</font>";
else
echo "<font style='font-family:돋움; font-size:9pt; color:#281900;'>[{$list[$i][ca_name]}] </font>";
echo "<font style='font-family:돋움; font-size:9pt; color:#281900;'>{$list[$i][subject]}</font>";
echo "</a>";
if ($list[$i][comment_cnt])
echo " <a href=\"{$list[$i][comment_href]}\"><span style='font-family:돋움; font-size:8pt; color:#281900;'>{$list[$i][comment_cnt]}</span></a>";
// if ($list[$i]['link']['count']) { echo "[{$list[$i]['link']['count']}]"; }
// if ($list[$i]['file']['count']) { echo "<{$list[$i]['file']['count']}>"; }
이벤트를 event로 쓰니 되기는 하네요