하나의 최신글에 여러개 게시판 추출 채택완료
용용이당
3년 전
조회 2,270
latest.lib.php에 추가 코드
</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> $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.php
</p>
<p><?php</p>
<p>if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가</p>
<p>include_once(G5_LIB_PATH.'/thumbnail.lib.php');</p>
<p> </p>
<p>// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨</p>
<p>add_stylesheet('<link rel="stylesheet" href="'.$latest_skin_url.'/style.css">', 0);</p>
<p>$thumb_width = 200;</p>
<p>$thumb_height = 200;</p>
<p>?></p>
<p> </p>
<p><div class="owl-carousel owl-theme"></p>
<p> <?php</p>
<p> for ($i=0; $i<count($list); $i++) {</p>
<p> $thumb = get_list_thumbnail($list[$i]['$bo_table'], $list[$i]['wr_id'], $thumb_width, $thumb_height, false, true);</p>
<p> </p>
<p> if($thumb['src']) {</p>
<p> $img = $thumb['src'];</p>
<p> } else {</p>
<p> $img = G5_IMG_URL.'/no_img.png';</p>
<p> $thumb['alt'] = '이미지가 없습니다.';</p>
<p> }</p>
<p> $img_content = '<img src="'.$img.'" alt="'.$thumb['alt'].'" >';</p>
<p> ?></p>
<p> <div class="item"><a href="<?php echo $list[$i]['href'] ?>"><?php echo $img_content; ?></a></div></p>
<p> </p>
<p> <?php } ?></p>
<p></div></p>
<p>
index.php
</p>
<p><?php echo latest_all('theme/pic_basic_owl', 'design,prints,sticker,book,digital,boo,sign', 12, 24); ?></p>
<p>
이렇게 사용중인데 썸네일 이미지가 안따라오네요..
해결 방법이 있을까요???
댓글을 작성하려면 로그인이 필요합니다.
답변 1개
답변을 작성하려면 로그인이 필요합니다.
로그인