최신글 날짜별로 정렬하는 방법을 알고 싶네요`~

최신글 날짜별로 정렬하는 방법을 알고 싶네요`~

QA

최신글 날짜별로 정렬하는 방법을 알고 싶네요`~

본문

안녕하세요`~
다름이 아니라 제가 날짜수정이 가능한 게시판을 사용하고 있는 최신글도 날짜수정시 바뀌어 정렬될 수 있도록 하고 싶습니다. 

아래 소스가 최신글의 소스인데 어느부분을 수정해야 할지 몰라 초짜가 문의드립니다.


<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 

if(!$options) $options=3;

$cols  = $options; //  이미지 가로갯수 //  이미지 세로 갯수는 메인에서 지정(총 이미지 수)
$image_h  = 20; // 이미지 상하 간격

$col_width = (int)(99 / $cols);

$data_path = $g4[path]."/data/file/$bo_table";
$thumb_path = $data_path.'/thumb';
?>

<link rel="stylesheet" href="<?=$latest_skin_path?>/style.css" type="text/css" />


<table width=100% border=0 align="center" cellpadding=0 cellspacing=0>
  <tr> 
    <td></td>
    <td background="<?=$latest_skin_path?>/img/box01_top.jpg"></td>
    <td width="5" height="5"><img src="<?=$latest_skin_path?>/img/box01_tr.jpg" width="5" height="5"></td>
  </tr>
  <tr> 
    <td></td>
    <td valign="top" ><table width="728" height="358" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td valign="top"></td>
        </tr>
        <tr>
          <td valign="top">
 
 <table width=100% border=0 align="center" cellpadding=0 cellspacing=0>
              <tr> 
                <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">

<!-- 이미지보이는 부분 시작 -->
<table align="center" cellpadding="0" cellspacing="0" width="100%" border="0">

<tr><td align='center'>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td height='2'></td></tr>
<tr>
<td align='center'>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
 <tr>

<? for ($i=0; $i<count($list); $i++) { 
 if ($i>0 && $i%$cols==0) { echo "</tr><tr><td colspan='$cols' height='$image_h'></td></tr><tr>"; } 
?> 

<td width="<?=$col_width?>%" align="center" valign='top'>

<?
$image = $list[$i][file][0][file]; //원본
$img=$data_path. "/".$image;  //썸네일이 없을경우 원본출력
$thumb = $thumb_path. "/". $list[$i][wr_id];

 if ( file_exists($thumb) )
$img = $thumb;
 
$style = "style='font-family:돋움; font-size:9pt; color:#686695;' ";
if ($list[$i][icon_new]) {
$style = "style='font-family:돋움; font-size:9pt; color:#134980;' "; }
 $subject = "<span $style>".$list[$i][subject]."</span>"; //제목 글자수 자르기
$wr_hit  = $list[$i]['wr_hit'];
$wr_id  = $list[$i]['wr_id'];
//    if ($list[$i]['comment_cnt']) //코
//        $cmt = "({$list[$i]['comment_cnt']})";

$bg = "";  //새글? 
if ($list[$i][icon_new])
$bg="la_top_2.gif";
else
$bg="la_top_1.gif";

echo $list[$i][icon_reply] . " ";

echo "<table cellpadding='0' cellspacing='0' border='0'>";
echo " <tr><td background='{$latest_skin_path}/img/la_bg.gif' valign='top' align='center'>
<a href=\"$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id=$wr_id\" onFocus=\"this.blur();\" title=\"{$list[$i][subject]}\">
<img src='{$img}' width='140' height='180' border=0' style='border:4 solid #ffffff'>
</a></td></tr>";
echo "</table>";
?>
</td>
<? } ?> 
<? 
$cnt = ($i%$cols); 
for ($k=$cnt; $k<$cols && $cnt; $k++) { 
echo "<td width=$col_width%>    </td>"; 
?> 
 <? if ($i+1 < count($list)) { echo "</tr><tr><td colspan='$cols' height='$image_h'></td></tr><tr>"; } ?> 
 <? if (count($list) == 0) { echo "<td height=80 align=center>게시물이 없습니다.</td>"; } ?>
 </tr>
</table>
</td>
</tr>
</table>
</td></tr>
</table>
<!-- 이미지보이는 부분 끝 -->
                
                </td>
              </tr>
            </table></td>
        </tr>
      </table></td>
    <td background="<?=$latest_skin_path?>/img/box01_right.jpg"></td>
  </tr>
  <tr> 
    <td></td>
    <td background="<?=$latest_skin_path?>/img/box01_bottom.jpg"></td>
    <td width="5" height="5"><img src="<?=$latest_skin_path?>/img/box01_br.jpg" width="5" height="5"></td>
  </tr>
</table>

이 질문에 댓글 쓰기 :

답변 1

lib/latest.lib.php
에서
    $sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_num limit 0, $rows ";
order by wr_num 을 order by wr_datetime 으로 바꿔주면 될꺼같네요..
테스트는 해보지 않앗습니다 -_-;
답변을 작성하시기 전에 로그인 해주세요.
전체 123,662 | RSS
QA 내용 검색

회원로그인

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