그룹최신글 질문드립니다.

그룹최신글 질문드립니다.

QA

그룹최신글 질문드립니다.

답변 1

본문

표퓨리님의 "그룹 최신글 추출입니다. "를 사용하고 있습니다.

그런데, 어느날 보니 입력 날자가 지난 자료가 나타나지를 않습니다.

그룹이 아닌 자료들은 이런 경우가 없는데요(물론 다른 최신글 스킨)

엣날 자료도 지정한 갯수 만큼 계속 보이게 할 수 있도록 하고 싶습니다.

아래와 같은 코드를 사용합니다.

도와주세요.

 

 

먼저 latest.liv.php


/* 그룹 최신글 추출 추가 함 */
function latest_group($skin_dir='', $gr_id, $rows=10, $subject_len=40, $cache_time=0, $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-{$gr_id}-{$skin_dir}-{$rows}-{$subject_len}.php";
        //$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;
 
}​

?>
​

 

다음은 latest group skin code 입니다.


<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.$latest_skin_url.'/style.css">', 0);
?>
<div class="lt">
    <strong class="lt_title"><?php echo $options; ?></strong>
    <ul>
    <?php for ($i=0; $i<count($list); $i++) {  ?>
        <li>
            <?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'];
             ?>
        </li>
    <?php }  ?>
    <?php if (count($list) == 0) { //게시물이 없을 때  ?>
    <li>게시물이 없습니다.</li>
    <?php }  ?>
    </ul>
</div>
<!-- } <?php echo $bo_subject; ?> 최신글 끝 -->​
 

 

이 질문에 댓글 쓰기 :

답변 1

최신게시글은 위 소스 36라인에 보면 g5_board_new 이 db table을 이용하는 것을 볼 수 있습니다.


관리자 > 환경설정 > 기본환경에 보면

최근게시글 삭제 설정일을 설정하는 곳이 있습니다.. 거기서 설정한 날짜가 지난 게시물은 위 테이블에서 자동삭제하겠죠...

이 날짜를 길게 잡아보세요.

 

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 14
© SIRSOFT
현재 페이지 제일 처음으로