탭메뉴 최신글 랜덤으로 불러오려면?? 정보
탭메뉴 최신글 랜덤으로 불러오려면??본문
안녕 하세요 ??
운영자님 그리고 고수님들의 도움을 요청해 봅니다.
오래동안 글등록이 없을때는 같은 내용이 오래동안
최신글로 첫페이지에 나와 있으니 변화가 없어 지루한 감이 있습니다
그래서 게시글을 최신글로 불러올때 페이지를 열때마다
무작위 랜덤으로 글을 불러왔으면 합니다
아래주소 스킨자료실에 있는 스킨중 네이버형 그룹 텝메뉴
http://onuri.co.kr/bbs/board.php?bo_table=05_2&wr_id=780
내용이 랜덤으로 나오게 하는 방법좀 알려주세요
초보자의 입장에서
답변좀 주시길 부탁 드립니다..
운영자님 그리고 고수님들의 도움을 요청해 봅니다.
오래동안 글등록이 없을때는 같은 내용이 오래동안
최신글로 첫페이지에 나와 있으니 변화가 없어 지루한 감이 있습니다
그래서 게시글을 최신글로 불러올때 페이지를 열때마다
무작위 랜덤으로 글을 불러왔으면 합니다
아래주소 스킨자료실에 있는 스킨중 네이버형 그룹 텝메뉴
http://onuri.co.kr/bbs/board.php?bo_table=05_2&wr_id=780
내용이 랜덤으로 나오게 하는 방법좀 알려주세요
초보자의 입장에서
답변좀 주시길 부탁 드립니다..
댓글 전체
아마 그 스킨안에 latest()함수가 들어갈껍니다.
함수 자체를 고치면 다른 함수들까지 똑같이 변할테니
<?
// 최신글 랜덤 추출
function latest_rend($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
{
global $g4;
global $g4_board;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/basic";
$list = array();
if(!$g4_board or !$g4_board["$bo_table"]){
//$sql = " select * from $g4[board_table] where bo_table = '$bo_table'";
$sql = " select bo_table, bo_notice, bo_subject, bo_subject_len, bo_use_list_content, bo_new, bo_use_sideview, bo_use_comment, bo_hot, bo_use_search from $g4[board_table] where bo_table = '$bo_table'";
$g4_board["$bo_table"] = sql_fetch($sql);
}
$board = $g4_board["$bo_table"];
$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_num limit 0, $rows ";
$sql = " select wr_id, wr_subject, wr_option, wr_content, wr_comment, wr_parent, wr_datetime, wr_last, wr_homepage, wr_name, wr_reply, wr_link1, wr_link2, ca_name, wr_hit, wr_file_count from $tmp_write_table order by rand()";
//explain($sql);
$result = sql_query($sql);
for ($i=0;$i<$rows; $i++){
$row = sql_fetch_array($result);
$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함수에서 order by만 rand()로 준겁니다.
함수 자체를 고치면 다른 함수들까지 똑같이 변할테니
<?
// 최신글 랜덤 추출
function latest_rend($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
{
global $g4;
global $g4_board;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/basic";
$list = array();
if(!$g4_board or !$g4_board["$bo_table"]){
//$sql = " select * from $g4[board_table] where bo_table = '$bo_table'";
$sql = " select bo_table, bo_notice, bo_subject, bo_subject_len, bo_use_list_content, bo_new, bo_use_sideview, bo_use_comment, bo_hot, bo_use_search from $g4[board_table] where bo_table = '$bo_table'";
$g4_board["$bo_table"] = sql_fetch($sql);
}
$board = $g4_board["$bo_table"];
$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_num limit 0, $rows ";
$sql = " select wr_id, wr_subject, wr_option, wr_content, wr_comment, wr_parent, wr_datetime, wr_last, wr_homepage, wr_name, wr_reply, wr_link1, wr_link2, ca_name, wr_hit, wr_file_count from $tmp_write_table order by rand()";
//explain($sql);
$result = sql_query($sql);
for ($i=0;$i<$rows; $i++){
$row = sql_fetch_array($result);
$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함수에서 order by만 rand()로 준겁니다.
ㅜㅜ 요즘 할일없이 몸만 바쁘다보니 이제서야 보는군요 ㅜ
님 답변 주셔서 감사합니다
함 해보고 결과를 올리도록 하겠습니다
님 답변 주셔서 감사합니다
함 해보고 결과를 올리도록 하겠습니다
잘안되네여 ㅠㅠㅠ
어떻게 해야되는지 ㅠㅠㅠ
어떻게 해야되는지 ㅠㅠㅠ