그룹 최신글 정보
그룹 최신글본문
추가 사항
1. lib/common.lib.php
function sql_query()에서 union을 허용 필요합니다.
2. lastet skin에서 bo_table은 $list 안에 있는 것을 써야 합니다.
3. cache 기능이 없습니다.
4. 대용량 DB에는 적합하지 않습니다.
function glatest($skin_dir='', $gr_id, $rows=10, $subject_len=40, $cache_time=1, $options='') {
global $g5;
if (!$skin_dir) $skin_dir = 'basic';
if(preg_match('#^theme/(.+)$#', $skin_dir, $match)) {
if (G5_IS_MOBILE) {
$latest_skin_path = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];
if(!is_dir($latest_skin_path))
$latest_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];
$latest_skin_url = str_replace(G5_PATH, G5_URL, $latest_skin_path);
} else {
$latest_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];
$latest_skin_url = str_replace(G5_PATH, G5_URL, $latest_skin_path);
}
$skin_dir = $match[1];
} else {
if(G5_IS_MOBILE) {
$latest_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;
$latest_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;
} else {
$latest_skin_path = G5_SKIN_PATH.'/latest/'.$skin_dir;
$latest_skin_url = G5_SKIN_URL.'/latest/'.$skin_dir;
}
}
$sqlg="select bo_table,bo_subject_len,bo_notice,bo_use_list_content,bo_use_sideview,bo_new,bo_hot,bo_use_list_file from {$g5['board_table']} where gr_id='$gr_id' ";
$reg = sql_query( $sqlg);
$board_set=array();
$sql=" select A.* from ( ";
if ( $row = sql_fetch_array( $reg)) {
$sql .=" ( select '{$row['bo_table']}' bo_table, g5_write_{$row['bo_table']}.* from g5_write_{$row['bo_table']} where wr_is_comment=0 order by wr_hit DESC limit 10 ) ";
$board_set[ $row['bo_table']]=$row;
while( $row = sql_fetch_array( $reg)) {
$sql .=" union ( select '{$row['bo_table']}' bo_table, g5_write_{$row['bo_table']}.* from g5_write_{$row['bo_table']} where wr_is_comment=0 order by wr_hit DESC limit 10 ) ";
$board_set[ $row['bo_table']]=$row;
}
$sql .=" ) A order by wr_hit limit 10 ";
}
$list = array();
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++) {
try {
unset($row['wr_password']); //패스워드 저장 안함( 아예 삭제 )
} catch (Exception $e) {
}
$row['wr_email'] = ''; //이메일 저장 안함
if (strstr($row['wr_option'], 'secret')){ // 비밀글일 경우 내용, 링크, 파일 저장 안함
$row['wr_content'] = $row['wr_link1'] = $row['wr_link2'] = '';
$row['file'] = array('count'=>0);
}
$list[$i] = get_list( $row, $board_set['bo_table'], $latest_skin_url, $subject_len);
}
ob_start();
include $latest_skin_path.'/latest.skin.php';
$content = ob_get_contents();
ob_end_clean();
return $content;
}
3
댓글 3개
<?php echo glatest('theme/basic', 'aa', 10, 40, 1,); ?>
입력해보니 오류떠요 ^^;;
<?php echo glatest('theme/basic', 'aa', 10, 40, 1,); ?>
이걸 그대로 쓰셨다면 제일 마지막에 콤마가 하나 더 들어간 게 문제 아닐까 싶습니다.