if (!defined('_GNUBOARD_')) exit;
// banner_latest(세로출력row 가로출력 col , 중앙[c] 왼쪽[l] 오른쪽[r] 하단[b] 그룹[g] 랜덤[d] , limit );
// 주의사항 : d 랜덤 일때는 무조건 limit 1 로 만듬
function banner_latest($skin="row", $loca="l" ,$limit="100")
{
global $config, $g5;
$upload_dir = "/data/banner/";
if($loca)
$sql_search = " and bn_location = '$loca'";
$order_by = "";
if($loca=="d"){ // 랜덤 이면 무조건 한개만 출력
$order_by = "order by rand() desc";
$limit = 1;
}else{
$order_by = "order by bn_seq asc";
}
$time = G5_TIME_YMDHIS;
$sql = "select * from g4_topschool_banner where bn_start_date < '$time' and bn_end_date > '$time' and bn_openchk = '1' $sql_search $order_by limit $limit";
$result = sql_query($sql);
if ($result) {
$i = 0;
while($rs = sql_fetch_array($result)) {
$file = "";
$target = "";
if($rs[bn_target])
$target = "target='_blank'";
if($rs[bn_file_type] == 13){
$file = "";
}else{
$file = "
| ";
}
$style="";
if($i >= 1)
$style="style=\"margin-top:10px;\"";
if($skin == "row")
echo "{$file}
";
if($skin == "col")
echo "{$file}";
$i++;
}
}
}
?>
if (!defined('_GNUBOARD_')) exit;
//최신글 랜덤 추출 방법
function random_latest($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
{
global $g4;
if ($skin_dir)
$latest_skin_path = "/skin/latest/$skin_dir";
else
$latest_skin_path = "/skin/latest/basic";
$current_time = time();
$opentime = date("Ymd", $current_time); // 컬랜트 타임을 일반시간으로 전환
$list = array();
$sql = " select * from g5_board where bo_table = '$bo_table'";
$board = sql_fetch($sql);
$tmp_write_table = $g5['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
$sql = " select * from $tmp_write_table where wr_10 >='$opentime' 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 "/skin/latest/yugi_banner/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>