RSS 최신글 셀렉트 메뉴에서 넘어갈때 오류 정보
RSS 최신글 셀렉트 메뉴에서 넘어갈때 오류관련링크
http://www.sustain.kr/index4.php
122회 연결
본문
제목이 좀 이상한데요 ;;
넙순님의
http://www.sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=69772&sca=&sfl=wr_subject&stx=RSS&sop=and 와
http://www.sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=50520&sca=&sfl=wr_subject&stx=RSS&sop=and 를 이용해서
사이트 메인 한가운데 RSS를 부착했습니다.
여기까지는 정상적으로 잘 가동이 되는데 셀렉트 메뉴로 다른 검색어를 선택하면 에러가 납니다.
(링크시킨 사이트 중앙 하단에 보시면.. 셀렉트 박스 있죠.. )
인덱스화일에 부착한 googlenews_sub.php의 소스는 다음과 같습니다.
아무래도 소스 앞쪽 location부분이 잘못되지 않았나 싶은데...
왜 그런지좀 알려주세요 ;;
<?php
include_once("./_common.php");
$html_title = "RSS Reader : 구글(www.google.com)";
$g4[title] = "" . $html_title;
include_once("$g4[path]/lib/rss.lib.php");
?>
<table width="463" cellpadding=0 cellspacing=0>
<tr><td height=5></td></tr>
<form name = "newsselect" method=get>
<tr>
<td>
<select name = "channel_select" onchange="location='./googlenews_sub.php?&channel_select='+this.value;">
<option value=""><-구글 뉴스 제공기사 선택-></option>
<option value = "1">주요기사</option>
<option value = "2">지속가능</option>
<option value = "3">경제</option>
<option value = "4">사회</option>
<option value = "5">문화/생활</option>
<option value = "6">세계</option>
<option value = "7">정보과학</option>
<option value = "8">스포츠</option>
<option value = "9">연예</option>
<option value = "10">인기뉴스</option>
</select>
</td>
<tr>
</form>
<tr><td height=5></td></tr>
</table>
<?
// url_fopen 허용
if (ini_get("allow_url_fopen") == 0) {
ini_set("allow_url_fopen", 1);
}
if ($channel_select == '') { $channel_list = "http://news.google.co.kr/?output=rss&ned=kr&topic=b"; }
else {
switch($channel_select)
{
case "1":
$channel_list = "http://news.google.co.kr/?output=rss&ned=kr&topic=b";
break;
case "2":
$channel_list = "http://news.google.co.kr/?output=rss&ned=kr&topic=b";
break;
case "3":
$channel_list = "http://news.google.co.kr/?output=rss&ned=kr&topic=b";
break;
case "4":
$channel_list = "http://news.google.co.kr/?output=rss&ned=kr&topic=y";
break;
case "5":
$channel_list = "http://news.google.co.kr/?output=rss&ned=kr&topic=l";
break;
case "6":
$channel_list = "http://news.google.co.kr/?output=rss&ned=kr&topic=w";
break;
case "7":
$channel_list = "http://news.google.co.kr/?output=rss&ned=kr&topic=t";
break;
case "8":
$channel_list = "http://news.google.co.kr/?output=rss&ned=kr&topic=s";
break;
case "9":
$channel_list = "http://news.google.co.kr/?output=rss&ned=kr&topic=e";
break;
case "10":
$channel_list = "http://news.google.co.kr/?output=rss&ned=kr&topic=po";
break;
} // switch
} // if
$rss = $rss_array = rss_array($channel_list);
$channel = $rss_array['channel']['title'];
$channel =iconv("utf-8","euc-kr","$channel");
$channel_link = $rss_array['channel']['link'];
?>
<table width="463" border="0" cellspacing="0" cellpadding="0">
<tr><td colspan=2 height="2" bgcolor=#B0ADF5></td></tr>
<tr bgcolor=#F8F8F9 height="30" align=center>
<td width="363"><b>'<?=$channel?>'</b> 검색 기사(RSS)</td>
<td width="100">시간</td>
</tr>
<tr><td colspan=2 height="1" bgcolor=#B0ADF5></td></tr>
<?
if(count($rss_array['items']) > 0 ) {
foreach ($rss_array['items'] as $item) {
// 뉴스 제목과 뉴스제공 신문사를 euc_kr로 변환한다.
$mtt1 =iconv("utf-8","euc-kr","{$item[title]}");
$mtt2 =iconv("utf-8","euc-kr","{$item['author']}");
$category = iconv("utf-8","euc-kr","{$item['category']}");
$url = $item['link'];
$pubdate = date('Y-m-d H:i:s', strtotime($item['pubdate']));
$arr_date = substr($pubdate, 2,2)."-".substr($pubdate, 5,2)."-".substr($pubdate, 8,2)." ".substr($pubdate, 11,8);
?>
<tr onmouseover="this.style.backgroundColor='#FAF1C2';" onmouseout="this.style.backgroundColor='#FFFFFF';">
<td height="26" style='padding-left:10px;' width="363">
<a href='<?=$url?>' target='_blank'><?=$mtt1?></a></td>
<td class=small align=center><?=$arr_date?></td></tr>
<tr><td colspan=2 height=1 bgcolor=#E7E7E7></td></tr>
<?
} //foreach
echo("</table><table><tr><td colspan='2' align=center height=20><p><div align=center>※위 내용은 RSS를 지원하는 사이트에서 방금 읽어온 내용으로만 구성되어 있습니다.</div><br></td></tr></table>");
} // 검색된 뉴스 갯수 IF
else {
echo("<tr><td colspan='2' align=center height=20>검색된 뉴스가 없습니다.</td></tr><tr><td colspan='2' height=1 bgcolor=#B0ADF5></td></tr></table><br></td></tr></table>");
}
?>
넙순님의
http://www.sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=69772&sca=&sfl=wr_subject&stx=RSS&sop=and 와
http://www.sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=50520&sca=&sfl=wr_subject&stx=RSS&sop=and 를 이용해서
사이트 메인 한가운데 RSS를 부착했습니다.
여기까지는 정상적으로 잘 가동이 되는데 셀렉트 메뉴로 다른 검색어를 선택하면 에러가 납니다.
(링크시킨 사이트 중앙 하단에 보시면.. 셀렉트 박스 있죠.. )
인덱스화일에 부착한 googlenews_sub.php의 소스는 다음과 같습니다.
아무래도 소스 앞쪽 location부분이 잘못되지 않았나 싶은데...
왜 그런지좀 알려주세요 ;;
<?php
include_once("./_common.php");
$html_title = "RSS Reader : 구글(www.google.com)";
$g4[title] = "" . $html_title;
include_once("$g4[path]/lib/rss.lib.php");
?>
<table width="463" cellpadding=0 cellspacing=0>
<tr><td height=5></td></tr>
<form name = "newsselect" method=get>
<tr>
<td>
<select name = "channel_select" onchange="location='./googlenews_sub.php?&channel_select='+this.value;">
<option value=""><-구글 뉴스 제공기사 선택-></option>
<option value = "1">주요기사</option>
<option value = "2">지속가능</option>
<option value = "3">경제</option>
<option value = "4">사회</option>
<option value = "5">문화/생활</option>
<option value = "6">세계</option>
<option value = "7">정보과학</option>
<option value = "8">스포츠</option>
<option value = "9">연예</option>
<option value = "10">인기뉴스</option>
</select>
</td>
<tr>
</form>
<tr><td height=5></td></tr>
</table>
<?
// url_fopen 허용
if (ini_get("allow_url_fopen") == 0) {
ini_set("allow_url_fopen", 1);
}
if ($channel_select == '') { $channel_list = "http://news.google.co.kr/?output=rss&ned=kr&topic=b"; }
else {
switch($channel_select)
{
case "1":
$channel_list = "http://news.google.co.kr/?output=rss&ned=kr&topic=b";
break;
case "2":
$channel_list = "http://news.google.co.kr/?output=rss&ned=kr&topic=b";
break;
case "3":
$channel_list = "http://news.google.co.kr/?output=rss&ned=kr&topic=b";
break;
case "4":
$channel_list = "http://news.google.co.kr/?output=rss&ned=kr&topic=y";
break;
case "5":
$channel_list = "http://news.google.co.kr/?output=rss&ned=kr&topic=l";
break;
case "6":
$channel_list = "http://news.google.co.kr/?output=rss&ned=kr&topic=w";
break;
case "7":
$channel_list = "http://news.google.co.kr/?output=rss&ned=kr&topic=t";
break;
case "8":
$channel_list = "http://news.google.co.kr/?output=rss&ned=kr&topic=s";
break;
case "9":
$channel_list = "http://news.google.co.kr/?output=rss&ned=kr&topic=e";
break;
case "10":
$channel_list = "http://news.google.co.kr/?output=rss&ned=kr&topic=po";
break;
} // switch
} // if
$rss = $rss_array = rss_array($channel_list);
$channel = $rss_array['channel']['title'];
$channel =iconv("utf-8","euc-kr","$channel");
$channel_link = $rss_array['channel']['link'];
?>
<table width="463" border="0" cellspacing="0" cellpadding="0">
<tr><td colspan=2 height="2" bgcolor=#B0ADF5></td></tr>
<tr bgcolor=#F8F8F9 height="30" align=center>
<td width="363"><b>'<?=$channel?>'</b> 검색 기사(RSS)</td>
<td width="100">시간</td>
</tr>
<tr><td colspan=2 height="1" bgcolor=#B0ADF5></td></tr>
<?
if(count($rss_array['items']) > 0 ) {
foreach ($rss_array['items'] as $item) {
// 뉴스 제목과 뉴스제공 신문사를 euc_kr로 변환한다.
$mtt1 =iconv("utf-8","euc-kr","{$item[title]}");
$mtt2 =iconv("utf-8","euc-kr","{$item['author']}");
$category = iconv("utf-8","euc-kr","{$item['category']}");
$url = $item['link'];
$pubdate = date('Y-m-d H:i:s', strtotime($item['pubdate']));
$arr_date = substr($pubdate, 2,2)."-".substr($pubdate, 5,2)."-".substr($pubdate, 8,2)." ".substr($pubdate, 11,8);
?>
<tr onmouseover="this.style.backgroundColor='#FAF1C2';" onmouseout="this.style.backgroundColor='#FFFFFF';">
<td height="26" style='padding-left:10px;' width="363">
<a href='<?=$url?>' target='_blank'><?=$mtt1?></a></td>
<td class=small align=center><?=$arr_date?></td></tr>
<tr><td colspan=2 height=1 bgcolor=#E7E7E7></td></tr>
<?
} //foreach
echo("</table><table><tr><td colspan='2' align=center height=20><p><div align=center>※위 내용은 RSS를 지원하는 사이트에서 방금 읽어온 내용으로만 구성되어 있습니다.</div><br></td></tr></table>");
} // 검색된 뉴스 갯수 IF
else {
echo("<tr><td colspan='2' align=center height=20>검색된 뉴스가 없습니다.</td></tr><tr><td colspan='2' height=1 bgcolor=#B0ADF5></td></tr></table><br></td></tr></table>");
}
?>
댓글 전체
쪽지받고 답변드립니다.
http://www.sustain.kr/bbs/googlenews_sub.php?channel_select=1
http://www.sustain.kr/bbs/googlenews_sub.php?channel_select=2
http://www.sustain.kr/bbs/googlenews_sub.php?channel_select=3
이런식으로 나오게 해야 해당페이지가 열립니다.
<select name = "channel_select" onchange="location='./googlenews_sub.php?&channel_select='+this.value;">
이부분을
<select name = "channel_select" onchange="location='./bbs/googlenews_sub.php?channel_select='+this.value;"> 로 수정하셔야 하고
css화일 경로문제로 페이지가 이상하네요..
http://www.sustain.kr/bbs/googlenews_sub.php?channel_select=1
http://www.sustain.kr/bbs/googlenews_sub.php?channel_select=2
http://www.sustain.kr/bbs/googlenews_sub.php?channel_select=3
이런식으로 나오게 해야 해당페이지가 열립니다.
<select name = "channel_select" onchange="location='./googlenews_sub.php?&channel_select='+this.value;">
이부분을
<select name = "channel_select" onchange="location='./bbs/googlenews_sub.php?channel_select='+this.value;"> 로 수정하셔야 하고
css화일 경로문제로 페이지가 이상하네요..
아. 답변잘 받았습니다.
그런데 문제는 현재 위치한 메인페이지 그 자리에서 링크한 리스트가 뿌려져야 하는건데..
즉. 지금 링크된 건 그냥 별도 페이지가 열려서 안되고
마치 탭메뉴처럼 셀렉트 메뉴를 선택하면 그 자리에서 리스트가 보여야 하거든요..
ㅜㅜ;;
그런데 문제는 현재 위치한 메인페이지 그 자리에서 링크한 리스트가 뿌려져야 하는건데..
즉. 지금 링크된 건 그냥 별도 페이지가 열려서 안되고
마치 탭메뉴처럼 셀렉트 메뉴를 선택하면 그 자리에서 리스트가 보여야 하거든요..
ㅜㅜ;;