load->model('board_model'); $brd_array = array(); // 통합 RSS 인 경우 if( empty($brd_key) ) { $board_list = $this->db->where('brd_use_total_rss','Y')->where('brd_lv_read', '0')->get('board')->result_array(); foreach($board_list as $b) { $brd_array[] = $b['brd_key']; } } else { $board = $this->board_model->get_board($brd_key, TRUE); if( $board['brd_use_rss'] != 'Y' OR $board['brd_lv_read'] > 0 ) { die('해당 게시판은 RSS 사용 설정이 되어있지 않습니다.'); } $brd_array[] = $brd_key; } if( count($brd_array) <= 0) { die('RSS를 사용할수 있는 게시판이 없습니다.'); } $post_list = $this->db ->select('board_post.*,board.brd_title') ->join('board','board.brd_key=board_post.brd_key','inner') ->where_in('board_post.brd_key', $brd_array) ->where('post_status' ,'Y') ->order_by('post_num DESC, post_reply ASC, post_idx DESC') ->limit(50) ->get('board_post') ->result_array(); header('content-type: text/xml'); header('cache-control: no-cache, must-revalidate'); header('pragma: no-cache'); $title = (empty($brd_key)) ? $this->site->config('site_title').' 통합 RSS': $board['brd_title'] . ' RSS'; $url = (empty($brd_key)) ? base_url() : base_url('board/'.$brd_key); $copyright = $this->site->config('site_title'); $description = (empty($brd_key)) ? $this->site->config('site_meta_description') : $board['brd_description']; ob_start(); echo "\n"; echo "\n"; echo "\n"; echo "" . html_escape(element('title', $title)) . "\n"; echo "" . $url . "\n"; if ($copyright) { echo ""; } if ($description) { echo ""; } foreach ($post_list as $row) { echo "\n"; echo "<![CDATA[" . element('post_title', $row) . "]]>\n"; echo "" . base_url( "board/{$row['brd_key']}/{$row['post_idx']}") . "\n"; echo "" . html_escape(element('mem_nickname', $row)) . "\n"; echo "" . date('Y-m-d', strtotime($row['post_regtime'])) . "\n"; echo "\n"; echo "" . html_escape($row['brd_title']) . "\n"; echo "\n"; } echo "\n"; echo "\n"; $xml = ob_get_clean(); echo $xml; } }