테스트 사이트 - 개발 중인 베타 버전입니다

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

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

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

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

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

</span></span></p><p style="font-size: 14.6667px;"><span style="font-family: Arial, 돋움, Dotum; color: rgb(72, 72, 72);"><span style="font-size: 14.004px;">$thumb = get_list_thumbnail($list[$i]['bo_table'], $list[$i]['wr_id'], $imgwidth, $imgheight);    </span></span> </p><p style="font-size: 14.6667px;">

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

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

</p><p style="font-size: 14.6667px;"><div id="main_right" style="width:580px; height:303px;"></p><p style="font-size: 14.6667px;">
</p><p style="font-size: 14.6667px;"><span style="white-space: pre;">	</span><div class="gallery_box"></p><p style="font-size: 14.6667px;">        <a href="<a href="<a href="http://ilhanul.or.kr/bbs/board.php?bo_table=active_support01" target="_blank" rel="noopener noreferrer">http://ilhanul.or.kr/bbs/board.php?bo_table=active_support01</a>"><a href="http://ilhanul.or.kr/bbs/board.php?bo_table=active_support01" target="_blank" rel="noopener noreferrer">http://ilhanul.or.kr/bbs/board.php?bo_table=active_support01</a></a>"><img src="<a href="<a href="http://ilhanul.or.kr/theme/CB_Company_v2_free/img/main_board_tit03.gif" target="_blank" rel="noopener noreferrer">http://ilhanul.or.kr/theme/CB_Company_v2_free/img/main_board_tit03.gif</a>"><a href="http://ilhanul.or.kr/theme/CB_Company_v2_free/img/main_board_tit03.gif" target="_blank" rel="noopener noreferrer">http://ilhanul.or.kr/theme/CB_Company_v2_free/img/main_board_tit03.gif</a></a>" /></a></p><p style="font-size: 14.6667px;"><span style="white-space: pre;">		</span><?php</p><p style="font-size: 14.6667px;"><span style="white-space: pre;">		</span>echo latest_all ("/clean_gallery", "self_support02, active_support01", 3, 15);</p><p style="font-size: 14.6667px;"><span style="white-space: pre;">		</span>?></p><p style="font-size: 14.6667px;"><span style="white-space: pre;">	</span></div></p><div>
스킨은 https://sir.kr/g5_skin/2209">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 게시글이 노출 안되는데, 이유가 뭘까요?
원인을 찾았습니다. 새글을 등록해야만 뜨네예.
여튼 해결했습니다.
감사합니다.

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

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

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

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

게시판을 그룹을 묶고 이런식으로 해주셔야 합니다.

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

답변에 대한 댓글 2개

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

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

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

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

로그인
🐛 버그신고