rss 뽑아 오기

rss 뽑아 오기

QA

rss 뽑아 오기

본문

수고하십니다.

아래와 같이 rss관련해서 테스트를 해봤습니다.

 

내용이 15개만 나오고 더이상 나오지 않는데

더 많이 나오게 하려면 어떻게 해야 할까요?

 

감사합니다.

 

// RSS 갯수
$rss_rows = $config['cf_page_rows'];
 

https://sir.kr/g5_plugin/5982?sfl=wr_subject%7C%7Cwr_content&stx=rss

 

 


<?php
$g5_path = ''; // common.php 의 상대 경로
include_once('common.php');
// 특수문자 변환
function specialchars_replace($str, $len=0) {
    if ($len) {
        $str = substr($str, 0, $len);
    }
    $str = str_replace(array("&", "<", ">"), array("&", "<", ">"), $str);
    return $str;
}
function conv_rich_content($matches){
    global $view;
    return view_image($view, $matches[1], $matches[2]);
}
function conv_link_video($link) {
    if(!$link) return;
    // 비디오, 오디오 체크
    $vext = array("mp4", "m4v", "f4v", "mov", "flv", "webm", "acc", "m4a", "f4a", "mp3", "ogg", "oga", "rss");
    list($link_video) = explode("|", $link);
        
    $file = apms_get_filename($link_video);
    $str = '';
    if(isset($file['ext']) && $file['ext'] && in_array($file['ext'], $vext)) {
        if(apms_jwplayer($link_video)) {
            $str = '<p>{video:'.$link_video.'|file=1}</p>';
        }
    } else {
        $video = apms_video_info($link_video);
        if(isset($video['vid']) && $video['vid']) {
            $str = '<p>{video:'.$link_video.'}</p>';
        }
    }
    return $str;
}
function img_insert_content($matches){
    global $row;
    return view_image($row, $matches[1], $matches[2]);
}
// RSS 갯수
$rss_rows = $config['cf_page_rows'];
// 통합 RSS bo_table
$bo = array();
$result = sql_query(" select bo_table from {$g5['board_table']} where bo_read_level = '1' and bo_table <> '' "); // 
for ($i=0; $row=sql_fetch_array($result); $i++) {
    $bo[$i] = $row['bo_table'];
}
if (!$i) {
    echo 'RSS 보기가 가능한 게시판이 없습니다.';
    exit;
}

// Feed 동영상
$is_feedvideo = true;
header('Content-type: text/xml');
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
echo '<?xml version="1.0" encoding="utf-8" ?>'."\n";
?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title><?php echo specialchars_replace($config['cf_title']); ?></title>
<link><?php echo specialchars_replace(G5_URL); ?></link>
<description><?php echo ($xp['seo_desc']) ? specialchars_replace($xp['seo_desc']) : specialchars_replace($config['cf_title']); ?></description>
<language>ko</language>
<?php
// 추출하기
$bo_list = ($i > 0) ? implode(',', $bo) : $bo[0];
$result = sql_query(" select * from {$g5['board_new_table']} where wr_id = wr_parent and find_in_set(bo_table, '{$bo_list}') order by bn_id desc limit 0, $rss_rows ", false);
for ($i=0; $post=sql_fetch_array($result); $i++) {
    $tmp_write_table = $g5['write_prefix'] . $post['bo_table']; 
    $row = sql_fetch(" select * from $tmp_write_table where wr_id = '{$post['wr_id']}' ", false);
    $board = sql_fetch(" select bo_subject from {$g5['board_table']} where bo_table = '{$post['bo_table']}' ");
    // 링크
    for ($i=k; $k<=G5_LINK_COUNT; $k++) {
        $row['link'][$i] = set_http(get_text($row["wr_link{$k}"]));
    }
    if (strstr($row['wr_option'], 'html'))
        $html = 1;
    else
        $html = 0;
    // 확장보드
//    $wr_data = apms_unpack($row['wr_content']);
//
//    if($row['as_extend'] || $wr_data['content']) {
//        $row['wr_content'] = $wr_data['content'];
//    }
    $row['wr_content'] = conv_content($row['wr_content'], $html);
    $file = $head_file = $tail_file = '';
    if($row['as_img'] == "2") { // 본문삽입
        $row['wr_content'] = preg_replace_callback("/{이미지\:([0-9]+)[:]?([^}]*)}/i", "img_insert_content", $row['wr_content']);
    } else {
        $tmp = get_file($post['bo_table'], $post['wr_id']);
        for ($j=0; $j<count($tmp); $j++) {
            if (isset($tmp[$j]['source']) && $tmp[$j]['source'] && $tmp[$j]['view']) {
                $file .='<p><img src="'.$tmp[$j]['path'].'/'.$tmp[$j]['file'].'"></p>';
            }
        }
        if($row['as_img'] == "1") {
            $head_file = $file;
        } else {
            $tail_file = $file;
        }
        //$row['wr_content'] = $head_file.apms_link_video($row['link']);//.apms_content($row['wr_content']).$tail_file;
    
    }
    $post_url = G5_BBS_URL .'/board.php?bo_table='.$post['bo_table'].'&wr_id='.$post['wr_id'];
?>
    <item>
    <title><?php echo specialchars_replace('['.$board['bo_subject'].'] '.$row['wr_subject']) ?></title>
    <link><?php echo $post_url; ?></link>
    <description><![CDATA[<?php echo $row['wr_content']; ?>]]></description>
    <dc:creator><?php echo specialchars_replace($row['wr_name']) ?></dc:creator>
    <?php
    $date = $row['wr_datetime'];
    // rss 리더 스킨으로 호출하면 날짜가 제대로 표시되지 않음
    //$date = substr($date,0,10) . "T" . substr($date,11,8) . "+09:00";
    $date = date('r', strtotime($date));
    ?>
    <pubDate><?php echo $date ?></pubDate>
    <guid><?php echo $post_url; ?></guid>
    </item>
<?php } ?>
</channel>
</rss>

이 질문에 댓글 쓰기 :

답변 1

// RSS 갯수
$rss_rows = $config['cf_page_rows'];

이부분을 늘리세요

ex) 100개

$rss_rows = 100;

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

회원로그인

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