최근게시물 오류좀 봐주세요... 정보
최근게시물 오류좀 봐주세요...- OCPlicense 자기소개 아이디로 검색 회원게시물
- 조회 800
- 댓글 2
본문
<table width="181" cellpadding="0" cellspacing="0">
<tr>
<td width="181" height="67" valign="top">
<p><?
include_once("./_common.php");
define("_CO_INDEX_", TRUE);
$html_title = "커뮤니티";
$g4[title] = "" . $html_title;
$before_day = 1; //게시물을 추출할기간설정
$before_time = date("Y-m-d H:i:s", $g4[server_time] - (86400 * $before_day));
$list1 = array();
$top1 = 5;
$gr_id_new = "cate"; //그룹아이디
$sql = " select bo_table, bo_notice from $g4[board_table]
where gr_id = '$gr_id_new'
and bo_use_search = 1 ";
$result = sql_query($sql);
while ($row = sql_fetch_array($result))
{
$sql2 = " select * from $g4[write_prefix]$row[bo_table]
where wr_comment > -1
and wr_datetime >= '$before_time' ";
$result2 = sql_query($sql2);
while ($row2 = sql_fetch_array($result2))
{
$key = substr('00000'.$row2[wr_comment],-5) . '-' . $row2[wr_id];
$list1[$key][subject] = conv_subject($row2[wr_subject],22,'…');
$list1[$key][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]";
$list1[$key][bo_table] = $row[bo_table];
$list1[$key][wr_id] = $row2[wr_id];
$list1[$key][is_notice] = preg_match("/[^0-9]{0,1}{$row2[wr_id]}[\r]{0,1}/",$row[bo_notice]);
$list1[$key][comment] = $row2[wr_comment];
$list1[$key][comment_cnt] = "($row2[wr_comment])";
$key = substr('00000'.$row2[wr_hit],-5) . '-' . $row2[wr_id];
$list2[$key][subject] = conv_subject($row2[wr_subject],22,'…');
$list2[$key][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]";
$list2[$key][bo_table] = $row[bo_table];
$list2[$key][wr_id] = $row2[wr_id];
$list2[$key][is_notice] = preg_match("/[^0-9]{0,1}{$row2[wr_id]}[\r]{0,1}/",$row[bo_notice]);
$list2[$key][wr_hit] = $row2[wr_hit];
$list2[$key][hit] = "($row2[wr_hit])";
$list2[$key][comment] = $row2[wr_comment];
$list2[$key][comment_cnt] = "($row2[wr_comment])";
$list2[$key][wr_good] = $row2[wr_good];
$list2[$key][good] = "($row2[wr_good])";
$list2[$key][content] = cut_str(get_text($row2[wr_content]), 80);
$list2[$key][file][0][file] = $row2[file][1][file];
}
}
$latest_skin_path = "$g4[path]/skin/latest/rank";
?></p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<?
$i=0;
foreach($list2 as $key=> $value) {
if ($i++>=($top1)) break;
?>
<tr><td background="<?=$latest_skin_path?>/img/bg.gif" style='word-break:break-all;'>
<p><?
//이미지 찾아오기 1
$sql_1 = " select bf_file from `$g4[board_file_table]` where bo_table = '{$list2[$key][bo_table]}' and wr_id = '{$list2[$key][wr_id]}' order by bf_no limit 1 ";
$result_1 = mysql_fetch_array(sql_query($sql_1));
//##### 기본파일경로 또는 썸네일 사용은 둘중 하나만선택하셔서 잡으셔야 합니다.
//기본 파일경로 사용할경우
$data_path = "$g4[path]/data/file/{$list2[$key][bo_table]}/"; //게시판 업로드 기본경로
$list2[$key][bf_file] = $data_path . $result_1[bf_file]; //퍼일 전체경로 = 해당게시판 해당글의 파일명 : $result_1[bf_file]
$check = $list2[$key][bf_file];
//echo "{$list2[$key][bf_file]}";
//섬네일 사용할경우
//섬네일 생성 구문 추가 필요
//$data_path = "$g4[path]/_thumb/_$gr_id_new/rank_day/"; //섬네임 특정 디렉토리 생성 경로
//$thum = ".Thum";
//$list2[$key][bf_file] = $data_path . $result_1[bf_file] . $thum; //퍼일 전체경로 = 해당게시판 해당글의 파일명 : $result_1[bf_file]
if($i==1){
$image_check = @getimagesize($list2[$key][bf_file]); //이미지 유무판단을 위한 임시사용
if($image_check[0]){
$l_sub = cut_str(get_text($list2[$key][subject]), 24);
echo "<table width=180 cellpadding=0 cellspacing=0 border=0>
<tr>
<td valign=top class=kor11 style='padding:0px 0px 0px 0px;'>
<table width=80 cellpadding=0 cellspacing=0 border=0>
<img src='".$latest_skin_path."/img/no_s_".$i.".gif' border=0 align=absmiddle> <span style='font-family:돋움; font-size:9pt; color:#black;'><a href='{$list2[$key][href]}' class=rank11>{$l_sub}</a></span> <span style='font-family:돋움; font-size:8pt; color:#red;'>{$list2[$key][good]}</span></td></tr>";
echo "</tr>
</table></td></table>";
} else {
echo "
<img src='".$latest_skin_path."/img/no_s_".$i.".gif' border=0 align=absmiddle><span style='font-family:돋움; font-size:9pt; color:#black;'><a href='{$list2[$key][href]}' class=rank11>{$l_sub} {$list2[$key][subject]}</a></span><span style='font-family:돋움; font-size:8pt; color:#red;'>{$list2[$key][good]}<div style = 'height:1px' ></div></span>
"; //이미지가 아닌경우 또는 이미지가 없는경우
}
} else {
echo "<table width=180 cellpadding=0 cellspacing=0 border=0>
<tr>
<td width=170>";
echo "<img src='".$latest_skin_path."/img/no_".$i.".gif' border=0 align=absmiddle> <a href='{$list2[$key][href]}'>";
if ($list2[$key][is_notice])
echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list2[$key][subject]}</strong></font>";
else
echo "<font style='font-family:돋움; font-size:9pt; color:#464646;'>{$list2[$key][subject]}</font>";
echo "</a>";
if ($list2[$key][good])
echo " <span style='font-family:돋움; font-size:8pt; color:#red;'>{$list2[$key][good]}</span>"; //히트수
echo "</td></tr></table>";
}
?></p>
</td>
</tr>
<? } ?>
<? if (count($list2) == 0) { ?>
<tr><td colspan=1 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
<? } ?>
</table> </td>
</tr>
</table>
위소스가 rank_day.php 소스인데 최근게시물로 불러와 쓰고 있습니다. 오늘 날짜에 등록된 최고의 게시물만 가져오게 되어 있는데... 오늘 날짜로 게시물이 하나도 등록되지 않았을때 오류가 뜨네요. 1개라도 등록이 되면 오류는 안뜹니다. 오류내용은 아래와 같습니다.
Warning: Invalid arqument supplied for foreach() in
/home/hosting_users/test/www/skin/latest/rank/rank_day.php
on line 73
아시는분 가르쳐 주세요...;
<tr>
<td width="181" height="67" valign="top">
<p><?
include_once("./_common.php");
define("_CO_INDEX_", TRUE);
$html_title = "커뮤니티";
$g4[title] = "" . $html_title;
$before_day = 1; //게시물을 추출할기간설정
$before_time = date("Y-m-d H:i:s", $g4[server_time] - (86400 * $before_day));
$list1 = array();
$top1 = 5;
$gr_id_new = "cate"; //그룹아이디
$sql = " select bo_table, bo_notice from $g4[board_table]
where gr_id = '$gr_id_new'
and bo_use_search = 1 ";
$result = sql_query($sql);
while ($row = sql_fetch_array($result))
{
$sql2 = " select * from $g4[write_prefix]$row[bo_table]
where wr_comment > -1
and wr_datetime >= '$before_time' ";
$result2 = sql_query($sql2);
while ($row2 = sql_fetch_array($result2))
{
$key = substr('00000'.$row2[wr_comment],-5) . '-' . $row2[wr_id];
$list1[$key][subject] = conv_subject($row2[wr_subject],22,'…');
$list1[$key][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]";
$list1[$key][bo_table] = $row[bo_table];
$list1[$key][wr_id] = $row2[wr_id];
$list1[$key][is_notice] = preg_match("/[^0-9]{0,1}{$row2[wr_id]}[\r]{0,1}/",$row[bo_notice]);
$list1[$key][comment] = $row2[wr_comment];
$list1[$key][comment_cnt] = "($row2[wr_comment])";
$key = substr('00000'.$row2[wr_hit],-5) . '-' . $row2[wr_id];
$list2[$key][subject] = conv_subject($row2[wr_subject],22,'…');
$list2[$key][href] = "$g4[bbs_path]/board.php?bo_table=$row[bo_table]&wr_id=$row2[wr_id]";
$list2[$key][bo_table] = $row[bo_table];
$list2[$key][wr_id] = $row2[wr_id];
$list2[$key][is_notice] = preg_match("/[^0-9]{0,1}{$row2[wr_id]}[\r]{0,1}/",$row[bo_notice]);
$list2[$key][wr_hit] = $row2[wr_hit];
$list2[$key][hit] = "($row2[wr_hit])";
$list2[$key][comment] = $row2[wr_comment];
$list2[$key][comment_cnt] = "($row2[wr_comment])";
$list2[$key][wr_good] = $row2[wr_good];
$list2[$key][good] = "($row2[wr_good])";
$list2[$key][content] = cut_str(get_text($row2[wr_content]), 80);
$list2[$key][file][0][file] = $row2[file][1][file];
}
}
$latest_skin_path = "$g4[path]/skin/latest/rank";
?></p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<?
$i=0;
foreach($list2 as $key=> $value) {
if ($i++>=($top1)) break;
?>
<tr><td background="<?=$latest_skin_path?>/img/bg.gif" style='word-break:break-all;'>
<p><?
//이미지 찾아오기 1
$sql_1 = " select bf_file from `$g4[board_file_table]` where bo_table = '{$list2[$key][bo_table]}' and wr_id = '{$list2[$key][wr_id]}' order by bf_no limit 1 ";
$result_1 = mysql_fetch_array(sql_query($sql_1));
//##### 기본파일경로 또는 썸네일 사용은 둘중 하나만선택하셔서 잡으셔야 합니다.
//기본 파일경로 사용할경우
$data_path = "$g4[path]/data/file/{$list2[$key][bo_table]}/"; //게시판 업로드 기본경로
$list2[$key][bf_file] = $data_path . $result_1[bf_file]; //퍼일 전체경로 = 해당게시판 해당글의 파일명 : $result_1[bf_file]
$check = $list2[$key][bf_file];
//echo "{$list2[$key][bf_file]}";
//섬네일 사용할경우
//섬네일 생성 구문 추가 필요
//$data_path = "$g4[path]/_thumb/_$gr_id_new/rank_day/"; //섬네임 특정 디렉토리 생성 경로
//$thum = ".Thum";
//$list2[$key][bf_file] = $data_path . $result_1[bf_file] . $thum; //퍼일 전체경로 = 해당게시판 해당글의 파일명 : $result_1[bf_file]
if($i==1){
$image_check = @getimagesize($list2[$key][bf_file]); //이미지 유무판단을 위한 임시사용
if($image_check[0]){
$l_sub = cut_str(get_text($list2[$key][subject]), 24);
echo "<table width=180 cellpadding=0 cellspacing=0 border=0>
<tr>
<td valign=top class=kor11 style='padding:0px 0px 0px 0px;'>
<table width=80 cellpadding=0 cellspacing=0 border=0>
<img src='".$latest_skin_path."/img/no_s_".$i.".gif' border=0 align=absmiddle> <span style='font-family:돋움; font-size:9pt; color:#black;'><a href='{$list2[$key][href]}' class=rank11>{$l_sub}</a></span> <span style='font-family:돋움; font-size:8pt; color:#red;'>{$list2[$key][good]}</span></td></tr>";
echo "</tr>
</table></td></table>";
} else {
echo "
<img src='".$latest_skin_path."/img/no_s_".$i.".gif' border=0 align=absmiddle><span style='font-family:돋움; font-size:9pt; color:#black;'><a href='{$list2[$key][href]}' class=rank11>{$l_sub} {$list2[$key][subject]}</a></span><span style='font-family:돋움; font-size:8pt; color:#red;'>{$list2[$key][good]}<div style = 'height:1px' ></div></span>
"; //이미지가 아닌경우 또는 이미지가 없는경우
}
} else {
echo "<table width=180 cellpadding=0 cellspacing=0 border=0>
<tr>
<td width=170>";
echo "<img src='".$latest_skin_path."/img/no_".$i.".gif' border=0 align=absmiddle> <a href='{$list2[$key][href]}'>";
if ($list2[$key][is_notice])
echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list2[$key][subject]}</strong></font>";
else
echo "<font style='font-family:돋움; font-size:9pt; color:#464646;'>{$list2[$key][subject]}</font>";
echo "</a>";
if ($list2[$key][good])
echo " <span style='font-family:돋움; font-size:8pt; color:#red;'>{$list2[$key][good]}</span>"; //히트수
echo "</td></tr></table>";
}
?></p>
</td>
</tr>
<? } ?>
<? if (count($list2) == 0) { ?>
<tr><td colspan=1 align=center height=30 background="<?=$latest_skin_path?>/img/board_bg_line.gif">게시물이 없습니다.</td></tr>
<? } ?>
</table> </td>
</tr>
</table>
위소스가 rank_day.php 소스인데 최근게시물로 불러와 쓰고 있습니다. 오늘 날짜에 등록된 최고의 게시물만 가져오게 되어 있는데... 오늘 날짜로 게시물이 하나도 등록되지 않았을때 오류가 뜨네요. 1개라도 등록이 되면 오류는 안뜹니다. 오류내용은 아래와 같습니다.
Warning: Invalid arqument supplied for foreach() in
/home/hosting_users/test/www/skin/latest/rank/rank_day.php
on line 73
아시는분 가르쳐 주세요...;
댓글 전체
<?
$i=0;
if( is_array( $list2)) foreach($list2 as $key=> $value) { <===== if문 추가요.
if ($i++>=($top1)) break;
?>
$i=0;
if( is_array( $list2)) foreach($list2 as $key=> $value) { <===== if문 추가요.
if ($i++>=($top1)) break;
?>
rolo 님 감사합니다...잘 되네요...