랜덤인가? 슬라이드인가? 로테션되는것? (요청) 정보
랜덤인가? 슬라이드인가? 로테션되는것? (요청)
본문
위와 같이 최근게시물을 만들고 싶은데 실력이 딸리네요..
고수님들 부탁드립니다.
[wr_subject][wr_1] [wr_2] [wr_3]가 들어갔으며 합니다.
뭐 안그러시면 대충돌아가게만 해주시면 ... 제가 나머진...
댓글 전체
1. 임의의 파일을 만들어서 extend 디렉토리에 넣습니다.
======================== random.lib.php ==================
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
function r_latest($skin_dir="", $bo_table, $rows=10, $subject_len=40)
{
global $config;
global $g4;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/$config[cf_latest_skin]";
$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_comment > -1
order by rand() 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;
}
?>
==================================================
2. 적용하고자 하는 곳에 아래와 같이 적어줍니다.
<?=r_latest('gd_latest2',photo, 2, 20);?>
나머지는 설명 안해도 잘 아시리라 봅니다. ^^
======================== random.lib.php ==================
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
function r_latest($skin_dir="", $bo_table, $rows=10, $subject_len=40)
{
global $config;
global $g4;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/$config[cf_latest_skin]";
$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_comment > -1
order by rand() 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;
}
?>
==================================================
2. 적용하고자 하는 곳에 아래와 같이 적어줍니다.
<?=r_latest('gd_latest2',photo, 2, 20);?>
나머지는 설명 안해도 잘 아시리라 봅니다. ^^