최신글을 하나의 게시판이 아닌 여러 게시판에서 받아오고 싶습니다. 채택완료
</span> </p><p>//skin_dir : 스킨명 , $bo_table : 게시판코드배열, rows : 출력 갯수, $subject : 게시판 제목</p><p>function latestNew($skin_dir='', $bo_tableobj, $subject, $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>
</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> $fboard = implode("_", $bo_tableobj);</p><p>
</p><p> $cache_fwrite = false;</p><p> if(G5_USE_CACHE) {</p><p> $cache_file = G5_DATA_PATH."/cache/latest-{$fboard}-{$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> $arrboard = implode("','", $bo_tableobj);</p><p>
</p><p> $sql = " select * from {$g5['board_new_table']} where bo_table in ('{$arrboard}') and wr_id = wr_parent order by bn_datetime desc limit 0, {$rows}";</p><p> $bres = sql_query($sql);</p><p> $bo_subject = get_text($subject);</p><p>
</p><p> for($i=0; $brow = sql_fetch_array( $bres ); $i++ ){</p><p> $tmp_write_table = $g5['write_prefix'] . $brow['bo_table']; // 게시판 테이블 전체이름</p><p> $sql = " select * from {$tmp_write_table} where wr_id = '{$brow['wr_id']}' ";</p><p> $row = sql_fetch( $sql );</p><p> $t_board = array ('bo_table' = $brow['bo_table'];</p><p> $list[$i] = get_list($row, $t_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><span style="font-size: 14.6667px;">
</p><p>$arrbo_table = array('notice','Testimony');</p><p><span style="font-size: 11pt;">echo latestNew('basic', $arrbo_table, "새글", 10);</span></p><p>
이렇게 작성하여 notice, Testimony 게시판 글중에서 최신글 10개만 뽑아 오려고 하는데
왜 안되는지 모르겠어요 도움 부탁드립니다.
이렇게 하면 아무것도 나타나지 않습니다.
echo latest('basic', notice, 10, 50); <- 이런씩으로 1개의 게시판 최근글은 잘 불러와집니다.
답변 2개
댓글을 작성하려면 로그인이 필요합니다.
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인