최신글 뽑아내기에서 에러가 발생합니다.
관련링크
본문
최신글 뽑아내기를 하고 있는데, 7개 정도만 뽑아오고 그 외에는 뽑아오지를 못합니다.
그래서 최신글 스킨에서
<?php for ($i=1; $i<count($list); $i++) { ?>
이렇게 되어 있는 조건문을
<?php for ($i=1; 15; $i++) { ?>
이렇게 바꾸어 강제로 15번을 돌게끔 하였더니
이제는 이러한 에러가 표시 됩니다.
select wr_content from g5_write_ where wr_id = ''
1146 : Table 'tnt4000.g5_write_' doesn't exist
error file : /index.php
그리고는 하단 부분까지 열리지가 않게 되었습니다.
참고로 인덱스 화면에서 입니다.
이렇게 불러들입니다.
<?php echo latest2("simple", "news", "15", "5", "1", "사천시민연합_뉴스"); ?>
lib에는 이렇게 선언되어 있습니다.
function latest2($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;
}
답변 2
아마도 캐시 기능때문이 아닐까 생각합니다.
config.php 파일에 아래 줄을 찾아...
define('G5_USE_CACHE', false); // 최신글등에 cache 기능 사용 여부
개발할때에는 위와 같이 캐시 기능을 끄고 해보세요.
수고하세요~~~
<?php for ($i=1; $i<=15; $i++) { ?>
이렇게 해보세요!