최근게시물 오류 도와 주세요... > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

최근게시물 오류 도와 주세요... 정보

최근게시물 오류 도와 주세요...

본문

<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];
}
}
krsort($list2);

$latest_skin_path = "$g4[path]/skin/latest/rank";
?></p>



     
 <table width="100%" border="0" cellspacing="0" cellpadding="0">


     

 <?
        $i=0;
        if( is_array( $list2)) 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>&nbsp;<span style='font-family:돋움; font-size:9pt; color:#black;'><a href='{$list2[$key][href]}' class=rank11>{$l_sub}</a></span>&nbsp;<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;'>&nbsp;<a href='{$list2[$key][href]}' class=rank11>{$l_sub}{$list2[$key][subject]}</a></span><span style='font-family:돋움; font-size:8pt; color:#red;'>&nbsp;{$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>&nbsp;<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>

--------------------------------------------------------------------------------------
오류내용: Warning: krsort() expects parameter 1 to be array, null given in
/home/hosting_users/test/www/skin/latest/rank/rank_day.php
on line 57

위 rank_day.php 의 소스인데(오늘최고 조회수 게시물만) 게시물이 하나도 등록되어 있지 않으면 오류가 발생 됩니다.

krsort($list2); 이 부분을 빼면 오류가 발생되지는 않지만 조회순으로 가져올수가 없습니다...;
어떻게 하면 krsort($list2); 를 그대로 사용하면서 오류를 안뜨게 할수 있을까요?;; 도움좀 주세요..

댓글 전체

전체 36 |RSS
그누4 질문답변 내용 검색

회원로그인

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