각 게시판 상단에 카테고리별로 별도의 페이지를 호출하게끔 수정했는데요,
좀더 욕심을 부려서 해당 카테고리에 등록된 게시물의 첨부 이미지를 그 별도의 페이지에 뿌려주고자 했어요.
여러모로 검색해보고 이것저것 다 적용해봤는데 결과는 꽝이네요.
http://www.happyjung.com/bbs/board.php?bo_table=lecture&wr_id=1680
위 소스 전체를 적용했더니 기존 랜덤 추출이랑 충돌이 있는 것 같아서 카테고리 부분만 빼서 저장했는데,
그냥 아무 것도 안 나오더라고요.
<?php echo latest_category("res2", "ko_res1", 2, 0, "연속 벨트형 브레이징로"); ?>
추출 코드는 위와 같이 적었구요. 혹시나 한글 카테고리명이어서 안 되나 싶어
<?php echo latest_category("res2", "ko_res1", 2, 0, "%EC%A7%84%EA%B3%B5+%EB%B8%8C%EB%A0%88%EC%9D%B4%EC%A7%95%EB%A1%9C"); ?>
이렇게도 넣어봤는데 결과는 마찬가지였어요. 매번 캐시 지우고 새로고침해서 확인했고요 ㅠㅠ
최근에 성공해보신 분 노하우 좀 알려주세요..
참고로, 추가한 lib 파일의 코드입니다. 혹시나 빠진 부분이 있을까봐 올려요.
Copy
<?php if (!defined('_GNUBOARD_')) exit; //2. 카테고리로 최신글 보이기// 사용법 : <?php echo latest_category("최신글스킨", "게시판이름", 게시물수, 제목글자수, "카테고리이름");? > // 최신글 카테고리 데이타만 추출function latest_category ($skin_dir="", $bo_table, $rows=10, $subject_len=40, $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}-category-{$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_once($cache_file); } } if(!G5_USE_CACHE || $cache_fwrite) { $list = array(); $sql = " select * from {$g5['board_table']} where bo_table = '{$bo_table}' "; $board = sql_fetch($sql); $bo_subject = get_text($board['bo_subject']); $tmp_write_table = $g5['write_prefix'] . $bo_table; // 게시판 테이블 전체이름 $sql = " select * from {$tmp_write_table} where ca_name = '{$options}' order by wr_num limit 0, {$rows} "; $result = sql_query($sql); for ($i=0; $row = sql_fetch_array($result); $i++) { $list[$i] = get_list($row, $board, $latest_skin_url, $subject_len); } 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; } ?>
답변 1개 / 댓글 1개
10년 전
연속 벨트형 브레이징로 가 하나의 카테고리 명인가요?
답변에 대한 댓글 1개
답변을 작성하려면 로그인이 필요합니다.