최신글 추출에서 여분필드5 분류 부분 추출 하려면

최신글 추출에서 여분필드5 분류 부분 추출 하려면

QA

최신글 추출에서 여분필드5 분류 부분 추출 하려면

본문

<?php echo latest("test", "0201 | 분류3 ",3,50, 25)?>

이렇게 해서 게시판의 분류 , 분류3을 메인화면에 추출 했는데요.

 2차 분류를 또 만들어 넣어서

여분 필드5(  wr_5 필드)에 서브분류1 | 서브분류2 | 서브분류3  이렇게 넣었습니다.

그리고

<?php echo latest("test", "0201 | 서브분류3 ",3,50, 25)?>

이렇게 했더니 안되네요..

서브분류3의 내용을 추출 방법이 없을까요?

 



	
		
			<?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; } ?>
		
	


 


 

 
   

이 질문에 댓글 쓰기 :

답변 2

소스가 저렇게 되어서 보기 힘들기때문에 말씀드리자면

해당 분류부분을 데이터로 가져와서 쿼리 부분을 수정해서 반영해 주셔야 합니다.

그래야 원하시는 해당 카테고리 부분을 가져올수가 있습니다.

소스는 확인되었는데 소스를 그대로 파악해서 만들어 드리기는 어려우며
변수에 category 변수를 전달받아 처리해 줘야 하는 부분이 필요합니다.
정 어려우시다면 조금의 제안비용이 발생되며 쪽지로 연락처를 주시고 요청주시거나
제작의뢰를 통해 진행하시길 요청드립니다.

latest.lib 파일

<?php
if (!defined('_GNUBOARD_')) exit;

// 최신글 추출
// $cache_time 캐시 갱신시간
function latest($skin_dir='', $bo_table, $rows=10, $subject_len=40, $cache_time=1, $options='')
{
    global $g5;

    list($bo_table, $category) = explode("|", $bo_table);
    if($category) $where = " AND ca_name = '".$category."' ";


    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 wr_is_comment = 0".$where." 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 파일

 

 

    <!-- 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 -->

 

 

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

회원로그인

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