메인화면 최신글 분류 추출 문의

메인화면 최신글 분류 추출 문의

QA

메인화면 최신글 분류 추출 문의

본문

분류변로 메인화면에 추출 하고싶은데요

<?php
  echo latest_cate("basic", "test", 5, 10,"", "", "분류1");
?>
이렇게 하고
latest.lib.php  파일을 아래 와 같이 파란색을 코드처럼 바꾸었는데요..
원하는 분류데로 안나오고 그냥 전체 가 다 보여집니다.
어디 잘못된데가 있는지요?


 
<?php
if (!defined('_GNUBOARD_')) exit;
// 최신글 추출
// $cache_time 캐시 갱신시간
function latest_cate($skin_dir='', $bo_table, $rows=10, $subject_len=40, $cache_time=1, $options='',$category="") 
{
    global $g5;
    if (!$skin_dir) $skin_dir = 'basic';
    if(preg_match('#^theme/(.+)$#', $skin_dir, $match)) {
        if (G5_IS_MOBILE) {
            $latest_skin_path = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];
            if(!is_dir($latest_skin_path))
                $latest_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];
            $latest_skin_url = str_replace(G5_PATH, G5_URL, $latest_skin_path);
        } else {
            $latest_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];
            $latest_skin_url = str_replace(G5_PATH, G5_URL, $latest_skin_path);
        }
        $skin_dir = $match[1];
    } else {
        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 * 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='{$ca_name}' AND wr_is_comment = 0 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='".sql_escape_string($bo_subject)."';\n\$list=".var_export($list, true)."?>";
            fwrite($handle, $cache_content);
            fclose($handle);
        }
    }
    ob_start();
    include $latest_skin_path.'/latest.skin.php';
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
?>

 

 

라테스트 스킨(latest.skin.php)은 이걸 쓰고 있습니다.


 
<div class="wrapper">
<h1 ><a href="<?php echo G5_BBS_URL ?>/board.php?bo_table=<?php echo $bo_table ?>"><?php echo $bo_subject; ?> ▶</a></h1>
    <!-- CONTENT BEGIN -->
    <div id="content" class="block_portfolio_4c">
        <div class="inner">
            <div class="block_four_columns">
                <ul class="block_filtered_items">
                    <!-- portfolio item -->
                    <?php
                        for ($i=0; $i<count($list); $i++) {  
                        /* 원본 이미지를 뽑아보자  - JooSung - 20150528 추가 */
                        $list[$i][file] =get_file($bo_table, $list[$i][wr_id]);
                        $file = $list[$i][file][0][path].'/'. $list[$i][file][0][file];
                        /* 원본 이미지를 뽑아보자  - JooSung - 20150528 추가 */
                        $thumb = get_list_thumbnail($bo_table, $list[$i]['wr_id'], $thumb_width, $thumb_height);
                        if($thumb['src']) {
                        $img = '<img src="'.$thumb['src'].'" width="'.$thumb_width.'" height="'.$thumb_height.'" title="'.$list[$i][subject].'" />';
                        } else {
                        $img = '<img src="'.$latest_skin_url.'/img/noimage.png" width="'.$thumb_width.'" height="'.$thumb_height.'" title="이미지 없음" />';
                        }
                        $content = cut_str(strip_tags($list[$i][wr_content]), 76);
                    ?>        
                                        
                    <li class="column_3 filtering_item <?php echo $list[$i][wr_link1]?"video":""?>" title="<?php echo $list[$i][ca_name]?>">
                        <div class="pic_wrapper">
                            <span class="block_general_pic">
                                <? if ($list[$i][wr_link1]) { ?>
                                <a href="<?php echo $list[$i][wr_link1]?>"  title="<?php echo $list[$i][subject]?>" class="hover_1">
                                <? } else { ?>
                                <a href="<?php echo $list[$i][href]?>"  title="<?php echo $list[$i][subject]?>" class="hover_1">
                                <? } ?>
                                    <img width="<?php echo $thumb_width?>" height="<?php echo $thumb_height?>" src="<?php echo $thumb['src']?>" class="r_conner_pic wp-post-image" title="<?php echo $list[$i][subject]?>" />
                                    <span class="block_hover"> </span>
                                </a>                            
                            </span>
                        </div>
                        <p style="padding:5px;"><strong><a href="<?php echo $list[$i][href]?>"><?php echo $list[$i][subject]?> </a></strong>
                    </li>
                    <? } ?>
                <!-- portfolio item -->                         
                </ul>
            </div>            
            
        </div>
    </div>
    <!-- CONTENT END -->
 

 

 

이 질문에 댓글 쓰기 :

답변 1

아래 해당 팁과 스킨을 참조하셔서 수정 또는 교체 하시면 될 듯합니다.

최신글 스킨은 기존것을 아무거나 쓰셔도 될테구요, 중요한건 latest.lib.php 파일의 코드입니다.

 

https://sir.kr/g5_tip/4129  <-- 이거 하나만 적용하셔도 잘 동작 할 겁니다.

 

https://sir.kr/g5_skin/2928

https://sir.kr/g5_skin/17903

 

 

 

답변을 작성하시기 전에 로그인 해주세요.
전체 28
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT