rss.php 파일 조금 수정 해봤습니다.
rss.php 파일 조금 수정 해봤습니다.
rss 서비스 할때 내용이 다 전송 되 길래 글자 제한.
로고 안 보여서 로고 보이게, 설명부분 .... 수정
이렇게
<?
include_once("./_common.php");
// 특수문자 변환
function specialchars_replace($str, $len=0)
{
if ($len) {
$str = substr($str, 0, $len);
}
$str = preg_replace("/&/", "&", $str);
$str = preg_replace("/</", "<", $str);
$str = preg_replace("/>/", ">", $str);
return $str;
}
$sql = " select gr_id, bo_subject, bo_page_rows, bo_read_level from $g4[board_table] where bo_table = '$bo_table' ";
$row = sql_fetch($sql);
$subj2 = specialchars_replace($row[bo_subject], 255);
$lines = $row[bo_page_rows];
// 비회원 읽기가 가능한 게시판만 RSS 지원
if ($row[bo_read_level] >= 2) {
echo "비회원 읽기가 가능한 게시판만 RSS 지원합니다.";
exit;
}
Header("Content-type: text/xml");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
$sql = " select gr_subject from $g4[group_table] where gr_id = '$row[gr_id]' ";
$row = sql_fetch($sql);
$subj1 = specialchars_replace($row[gr_subject], 255);
echo "<?xml version=\"1.0\" encoding=\"euc-kr\"?>\n";
echo "<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";
echo "<channel>\n";
echo "<title>".specialchars_replace("$subj1 > $subj2")."</title>\n";
echo "<link>".specialchars_replace("$g4[url]/$g4[bbs]/board.php?bo_table=$bo_table")."</link>\n";
echo "<description>안녕하세요?\n $config[cf_title] rss 서비스 입니다. </description>\n";
echo "<language>ko</language>\n";
echo "<image>\n";
echo "<title>안녕하세요?\n $config[cf_title] rss 서비스 입니다. </title>\n";
echo "<url>".specialchars_replace("$g4[url]/img/rss_logo.gif")."</url>\n";
echo "<link>$g4[url]</link>\n";
echo "</image>\n";
$sql = " select wr_id, wr_subject, wr_content, wr_name, wr_datetime, wr_option
from $g4[write_prefix]$bo_table
where wr_is_comment = 0
and wr_option not like '%secret%'
order by wr_num, wr_reply limit 0, $lines ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
$file = "";
//$file .= view_file_link($row[wr_file1]);
//$file .= view_file_link($row[wr_file2]);
//$file = preg_replace("/\.\//", "$cfg[d_url]/", $file);
if (strstr($row[wr_option], 'html'))
$html = 1;
else
$html = 0;
echo "<item>\n";
echo "<title>".specialchars_replace($row[wr_subject])."</title>\n";
echo "<link>".specialchars_replace("$g4[url]/$g4[bbs]/board.php?bo_table=$bo_table&wr_id=$row[wr_id]")."</link>\n";
$row[wr_content] = cut_str($row[wr_content],300," ....more ");
echo "<description><![CDATA[".$file . conv_content($row[wr_content], $html)."]]></description>\n";
echo "<dc:creator>".specialchars_replace($row[wr_name])."</dc:creator>\n";
$date = $row[wr_datetime];
// $date = substr($date,0,10) . "T" . substr($date,11,8) . "+09:00";
echo "<dc:date>$date</dc:date>\n";
echo "</item>\n";
}
echo "</channel>\n";
echo "</rss>\n";
?>
로고 보이시게 하려면 잘 만드셔서 /img 디렉토리에 넣으시면됩니다
로고명 : rss_logo.gif 맘에 안 들면 적당 맘데로 바꿔서 사용하세요.
적당히 잘라야 홈에도 .......
혹 몰라서 $row[wr_content1] = cut_str($row[wr_content],300," ....more ");
하고 이렇게 이렇게 해도됩니다.
rss 서비스 할때 내용이 다 전송 되 길래 글자 제한.
로고 안 보여서 로고 보이게, 설명부분 .... 수정
이렇게
<?
include_once("./_common.php");
// 특수문자 변환
function specialchars_replace($str, $len=0)
{
if ($len) {
$str = substr($str, 0, $len);
}
$str = preg_replace("/&/", "&", $str);
$str = preg_replace("/</", "<", $str);
$str = preg_replace("/>/", ">", $str);
return $str;
}
$sql = " select gr_id, bo_subject, bo_page_rows, bo_read_level from $g4[board_table] where bo_table = '$bo_table' ";
$row = sql_fetch($sql);
$subj2 = specialchars_replace($row[bo_subject], 255);
$lines = $row[bo_page_rows];
// 비회원 읽기가 가능한 게시판만 RSS 지원
if ($row[bo_read_level] >= 2) {
echo "비회원 읽기가 가능한 게시판만 RSS 지원합니다.";
exit;
}
Header("Content-type: text/xml");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
$sql = " select gr_subject from $g4[group_table] where gr_id = '$row[gr_id]' ";
$row = sql_fetch($sql);
$subj1 = specialchars_replace($row[gr_subject], 255);
echo "<?xml version=\"1.0\" encoding=\"euc-kr\"?>\n";
echo "<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";
echo "<channel>\n";
echo "<title>".specialchars_replace("$subj1 > $subj2")."</title>\n";
echo "<link>".specialchars_replace("$g4[url]/$g4[bbs]/board.php?bo_table=$bo_table")."</link>\n";
echo "<description>안녕하세요?\n $config[cf_title] rss 서비스 입니다. </description>\n";
echo "<language>ko</language>\n";
echo "<image>\n";
echo "<title>안녕하세요?\n $config[cf_title] rss 서비스 입니다. </title>\n";
echo "<url>".specialchars_replace("$g4[url]/img/rss_logo.gif")."</url>\n";
echo "<link>$g4[url]</link>\n";
echo "</image>\n";
$sql = " select wr_id, wr_subject, wr_content, wr_name, wr_datetime, wr_option
from $g4[write_prefix]$bo_table
where wr_is_comment = 0
and wr_option not like '%secret%'
order by wr_num, wr_reply limit 0, $lines ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
$file = "";
//$file .= view_file_link($row[wr_file1]);
//$file .= view_file_link($row[wr_file2]);
//$file = preg_replace("/\.\//", "$cfg[d_url]/", $file);
if (strstr($row[wr_option], 'html'))
$html = 1;
else
$html = 0;
echo "<item>\n";
echo "<title>".specialchars_replace($row[wr_subject])."</title>\n";
echo "<link>".specialchars_replace("$g4[url]/$g4[bbs]/board.php?bo_table=$bo_table&wr_id=$row[wr_id]")."</link>\n";
$row[wr_content] = cut_str($row[wr_content],300," ....more ");
echo "<description><![CDATA[".$file . conv_content($row[wr_content], $html)."]]></description>\n";
echo "<dc:creator>".specialchars_replace($row[wr_name])."</dc:creator>\n";
$date = $row[wr_datetime];
// $date = substr($date,0,10) . "T" . substr($date,11,8) . "+09:00";
echo "<dc:date>$date</dc:date>\n";
echo "</item>\n";
}
echo "</channel>\n";
echo "</rss>\n";
?>
로고 보이시게 하려면 잘 만드셔서 /img 디렉토리에 넣으시면됩니다
로고명 : rss_logo.gif 맘에 안 들면 적당 맘데로 바꿔서 사용하세요.
적당히 잘라야 홈에도 .......
혹 몰라서 $row[wr_content1] = cut_str($row[wr_content],300," ....more ");
하고 이렇게 이렇게 해도됩니다.
댓글 4개
hanpedro
20년 전
ㅎ 수고하십니다. 로고부분만큼은 g4의 다음 버전에 포함되면 좋을 것 같습니다.
20년 전
그냥 제가 필요해서 수정 한건데
글 주셔서 고맙습니다.
시간이 없어 글 자주 못 남깁니다.
휭~ 갑니다
글 주셔서 고맙습니다.
시간이 없어 글 자주 못 남깁니다.
휭~ 갑니다
20년 전
rss에 관해서
19년 전
굳 팁~!!
게시판 목록
그누4 팁자료실
그누보드4와 관련된 팁을 여러분들과 함께 공유하세요.
나누면 즐거움이 커집니다.
나누면 즐거움이 커집니다.
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 3289 | 9년 전 | 4823 | ||
| 3288 | 9년 전 | 5805 | ||
| 3287 |
|
9년 전 | 3508 | |
| 3286 |
또치하우스
|
9년 전 | 12305 | |
| 3285 | 10년 전 | 11507 | ||
| 3284 |
다람쥐7마리
|
10년 전 | 4685 | |
| 3283 |
블랙초콜렛더블샷
|
10년 전 | 5980 | |
| 3282 |
또치하우스
|
10년 전 | 10277 | |
| 3281 | 10년 전 | 9793 | ||
| 3280 | 10년 전 | 4999 | ||
| 3279 | 10년 전 | 4280 | ||
| 3278 | 10년 전 | 5364 | ||
| 3277 |
|
10년 전 | 5273 | |
| 3276 | 10년 전 | 5786 | ||
| 3275 | 10년 전 | 4354 | ||
| 3274 | 10년 전 | 5600 | ||
| 3273 | 10년 전 | 6912 | ||
| 3272 | 10년 전 | 7226 | ||
| 3271 | 10년 전 | 4943 | ||
| 3270 |
|
10년 전 | 5414 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기