여러 갤러리 게시글을 하나의 최신글로 불러 오고 싶습니다. 채택완료

https://sir.kr/g5_tip/4103?page=3

이 페이지 처럼 아래 latest.lib.php에 소스를 추가했으며,


Copy
<?phpif (!defined('_GNUBOARD_')) exit;// 최신글 추출// $cache_time 캐시 갱신시간function latest($skin_dir='', $bo_table, $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;        }    }    $cache_fwrite = false;    if(G5_USE_CACHE) {        $cache_file = G5_DATA_PATH."/cache/latest-{$bo_table}-{$skin_dir}-{$rows}-{$subject_len}.php";        if(!file_exists($cache_file)) {            $cache_fwrite = true;        } else {            if($cache_time > 0) {                $filetime = filemtime($cache_file);                if($filetime && $filetime < (G5_SERVER_TIME - 3600 * $cache_time)) {                    @unlink($cache_file);                    $cache_fwrite = true;                }            }            if(!$cache_fwrite)                include($cache_file);        }    }    if(!G5_USE_CACHE || $cache_fwrite) {        $list = array();        $sql = " select * from {$g5['board_table']} where bo_table = '{$bo_table}' ";        $board = sql_fetch($sql);        $bo_subject = get_text($board['bo_subject']);        $tmp_write_table = $g5['write_prefix'] . $bo_table; // 게시판 테이블 전체이름        $sql = " select * from {$tmp_write_table} where wr_is_comment = 0 order by wr_num limit 0, {$rows} ";        $result = sql_query($sql);        for ($i=0; $row = sql_fetch_array($result); $i++) {            $list[$i] = get_list($row, $board, $latest_skin_url, $subject_len);        }        if($cache_fwrite) {            $handle = fopen($cache_file, 'w');            $cache_content = "<?php\nif (!defined('_GNUBOARD_')) exit;\n\$bo_subject='".$bo_subject."';\n\$list=".var_export($list, true)."?>";            fwrite($handle, $cache_content);            fclose($handle);        }    }    ob_start();    include $latest_skin_path.'/latest.skin.php';    $content = ob_get_contents();    ob_end_clean();    return $content;}?><?php// $bo_tables 테이블들 사이 콤마(,) 단위로 구분해서 넣을 것, 콤마 사이에 공백 없이 (ex aaa,bbb,)function latest_all($skin_dir='', $bo_tables, $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;        }    }        $list = array();        $sql_common = " from {$g5['board_new_table']} a  where find_in_set(a.bo_table, '{$bo_tables}')";        $sql_common .= " and a.wr_id = a.wr_parent ";        $sql_order = " order by a.bn_id desc ";        $sql = " select a.* {$sql_common} {$sql_order} limit 0, {$rows}";        $result = sql_query($sql);                for ($i=0; $row=sql_fetch_array($result); $i++) {            $sql = " select * from {$g5['board_table']} where bo_table = '{$row['bo_table']}' ";                      $board = sql_fetch($sql);            $tmp_write_table = $g5['write_prefix'] . $row['bo_table'];            $row2 = sql_fetch(" select * from {$tmp_write_table} where wr_id = '{$row['wr_id']}' ");            $list[$i] = $row2;            $list[$i] = get_list($row2, $board, $latest_skin_url, $subject_len);            $list[$i]['bo_subject'] = $row['bo_subject'];            $list[$i]['bo_table'] = $row['bo_table'];        }    ob_start();    include $latest_skin_path.'/latest.skin.php';    $content = ob_get_contents();    ob_end_clean();    return $content;}?>


latest.skin 스킨파일에서는 아래의 소스로 수정했고 

Copy
$thumb = get_list_thumbnail($list[$i]['bo_table'], $list[$i]['wr_id'], $imgwidth, $imgheight);


index.php도 아래 같이 소스를 넣었습니다만,

다른 게시판의 데이타를 가져오질 못합니다.

Copy
<div id="main_right" style="width:580px; height:303px;">	<div class="gallery_box">        <a href="http://ilhanul.or.kr/bbs/board.php?bo_table=active_support01"><img src="http://ilhanul.or.kr/theme/CB_Company_v2_free/img/main_board_tit03.gif" /></a>		<?php		echo latest_all ("/clean_gallery", "self_support02, active_support01", 3, 15);		?>	</div>
스킨은 https://sir.kr/g5_skin/2209 이분것으로 했습니다만,
다른디자인의 latest.skin의 코드를 가져와도 되질 않습니다.
어찌해야 될까요?
도움 부탁드립니다. 

답변 3개

채택된 답변
+20 포인트

echo latest_all ("/clean_gallery""self_support02, active_support01", 3, 15); 

clean_gallery 앞에 슬러시는 왜 붙히셨나요?


echo latest_all ("clean_gallery""self_support02, active_support01", 3, 15); 

이렇게 하시면 게시글이 나올겁니다.

로그인 후 평가할 수 있습니다

답변에 대한 댓글 2개

echo latest_all ("clean_gallery", "self_support02, active_support01", 3, 15);
이렇게 해도, active_support01 게시글이 노출 안되는데, 이유가 뭘까요?
원인을 찾았습니다. 새글을 등록해야만 뜨네예.
여튼 해결했습니다.
감사합니다.

댓글을 작성하려면 로그인이 필요합니다.

어찌해야 될가요? ㅠ.ㅜ 도와주세요.

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

게시판을 그룹을 묶고 <?php echo latest("스킨명", "그룹묭", 이미지갯수, 제목글자수); ?> 이런식으로 해주셔야 합니다.

로그인 후 평가할 수 있습니다

답변에 대한 댓글 2개

<?php
echo latest ("/clean_gallery", "gallay_g", 3, 15);
?>

이렇게 했습니다만, 적용이 되질 않습니다.
변경하니깐, 기존의 나오던 이미지까지 안나옵니다.

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인
🐛 버그신고