채택완료
그룹추출 최근게시물에 이미지도 함께 넣으려면?
Copy
<?php<!-- } <?php echo $bo_subject; ?> 최신글 끝 -->include_once(G5_LIB_PATH.'/thumbnail.lib.php');// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨add_stylesheet('<link rel="stylesheet" href="'.$latest_skin_url.'/style.css">', 0);$n_thumb_width = 192; //썸네일 가로 크기$n_thumb_height = 165; //썸네일 세로 크기?><div> <strong><?php echo $options; ?></strong> <ul> <?php for ($i=0; $i<count($list); $i++) { ?> <li> <?php $n_thumb = get_list_thumbnail($bo_table, $list[$i]['wr_id'], $n_thumb_width, $n_thumb_height); // 스넵이미지 생성하고 뷰어 시킨다. $n_noimg = "$latest_skin_url/img/noimg.gif"; // 이미지가 없을경우의 이미지 위치 if($n_thumb['src']) { $img_content = '<img src="'.$n_thumb['src'].'" width="'.$n_thumb_width.'" height="'.$n_thumb_height.'" alt="'.$list[$i]['subject'].'" title="" />'; } else { $img_content = '<img src="'.$n_noimg.'" width="'.$n_thumb_width.'" height="'.$n_thumb_height.'" alt="이미지없음" title="" />'; } echo $img_content; ?> <?php //echo $list[$i]['icon_reply']." "; echo "<a href=\"".$list[$i]['href']."\">"; if ($list[$i]['is_notice']) echo "<strong>".$list[$i]['subject']."</strong>"; else echo $list[$i]['subject']; if ($list[$i]['comment_cnt']) echo $list[$i]['comment_cnt']; echo "</a>"; // if ($list[$i]['link']['count']) { echo "[{$list[$i]['link']['count']}]"; } // if ($list[$i]['file']['count']) { echo "<{$list[$i]['file']['count']}>"; } if (isset($list[$i]['icon_new'])) echo " " . $list[$i]['icon_new']; if (isset($list[$i]['icon_hot'])) echo " " . $list[$i]['icon_hot']; if (isset($list[$i]['icon_file'])) echo " " . $list[$i]['icon_file']; if (isset($list[$i]['icon_link'])) echo " " . $list[$i]['icon_link']; if (isset($list[$i]['icon_secret'])) echo " " . $list[$i]['icon_secret']; ?> <?php $wr_content = preg_replace("/<(.*?)\>/"," ",$list[$i][wr_content]); $wr_content = preg_replace("/ /"," ",$wr_content); $wr_content = str_replace("//##", " ", $wr_content); $wr_content = cut_str(get_text($wr_content), 100, '…'); echo $wr_content?> </li> <?php } ?> <?php if (count($list) == 0) { //게시물이 없을 때 ?> <li>게시물이 없습니다.</li> <?php } ?> </ul></div><!-- } <?php echo $bo_subject; ?> 최신글 끝 -->
http://sir.co.kr/bbs/board.php?bo_table=g5_skin&wr_id=4213&sca=%EC%B5%9C%EC%8B%A0%EA%B8%80
위 그룹 최근게시물을 사용해 이미지도 함께 나오게 하려고 하는데요
아무리 해도 이미지가 안나오는데 어떻게 해야 하는지 고수님들 고언 부탁드립니다.
답변 2개 / 댓글 1개
채택된 답변
+20 포인트
16라인의 $bo_table 을 $list[$i]['bo_table'] 로 바꿔보세요.
$n_thumb = get_list_thumbnail($list[$i]['bo_table'], $list[$i]['wr_id'], $n_thumb_width, $n_thumb_height);
latest.lib.php 에는 이 코드를 활용했습니다.
Copy
function latest_group($skin_dir='', $gr_id, $rows=10, $subject_len=40, $cache_time=1, $options='')} global $g5; //static $css = array(); if (!$skin_dir) $skin_dir = 'basic'; 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 a.*, b.bo_subject, c.gr_subject, c.gr_id from g5_board_new a, g5_board b, g5_group c where a.bo_table = b.bo_table and b.gr_id = c.gr_id and b.bo_use_search = 1 and c.gr_id = '{$gr_id}' and a.wr_id = a. wr_parent order by a.bn_id desc 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]['subject'] = "[".$row['bo_subject']."] ".$list[$i]['subject']; $list[$i]['bo_table'] = $row['bo_table']; } 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); } } /* // 같은 스킨은 .css 를 한번만 호출한다. if (!in_array($skin_dir, $css) && is_file($latest_skin_path.'/style.css')) { echo '<link rel="stylesheet" href="'.$latest_skin_url.'/style.css">'; $css[] = $skin_dir; } */ ob_start(); include $latest_skin_path.'/latest.skin.php'; $content = ob_get_contents(); ob_end_clean(); return $content; }
답변을 작성하려면 로그인이 필요합니다.