n

최근게시물을 랜덤출력하려고하는데용,

소스는 메인에 이미지와 텍스트가 동시에 출력되게 되어있습니다.
제가 직접 제작한게 아니고 친구가 수정 좀 부탁해서요 ^^

이게 게시판에 추가된 체크박스(베스트상품)을 체크한 제품 최근순으로 출력되는 거거든요,
체크 상관없이요 그냥 그 게시판에 있는 게시물을 랜덤으로 출력하는 방법 좀 알려주세요 ^^

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<table>
<tr>
<td>
<table width='100%' border='0' cellspacing='0' cellpadding='3'>
<tr>
<td colspan="2" width='100%'>
<table width=98% border=0 cellpadding=5>
<tr>

<?
for ($i=0; $i<count($list); $i++)
{
if( $i %5 == 0)
echo '</tr><tr>';
$title = get_text($list[$i][wr_subject]);
$content = cut_str(get_text($list[$i][wr_content]), 80);
$img = "$g4[path]/data/file/$bo_table/".urlencode($list[$i][file][0][file]);

if (!file_exists($img) || !$list[$i][file][0][file])
$img = "$latest_skin_path/img/no_image.gif";
$href = "$g4[bbs_path]/board.php?bo_table=$bo_table";

echo <<<HEREDOC

<td valign='top' align='center' nowrap>
<table width='100%' border='0' cellpadding='0' cellspacing='0' align='center'>
<tr>
<td width='100%' align='center'>
<div style='width:150px;height:130px;border:1px solid #CCCCCC;padding:1px' align='center'>
<a href='$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id={$list[$i][wr_id]}'><img src='{$img}' width='150' height='130' border='0' align='absmiddle' title='$title'></a>
</div>
</td>
</tr>
<tr>
<td width='100%' height='20' align='center'><a href='$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id={$list[$i][wr_id]}' class='link02'>{$list[$i][subject]}</a></td>
</tr>
<tr>
<td width='100%' height='20' align='center'><a href='$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id={$list[$i][wr_id]}'>{$list[$i][wr_4]}</a></td>
</tr>
<tr>
<td width='100%' height='20' align='center'><a href='$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id={$list[$i][wr_id]}'>{$list[$i][wr_5]}</a></td>
</tr>
</table>
</td>
HEREDOC;
}
?>
</tr>
</table>
<? if (count($list) == 0) { ?>게시물이 없습니다.<? } ?>
</td>
</tr>
</table>
</td>
</tr>
</table>

--------------------------------------------------------------

그냥 단순하게 테이블 반복해서 나오는거 같은데요,
이걸 랜덤으로 출력하려면 어떻게 해야하는지 도와주세요 ㅠ
|

댓글 3개

/lib/latest.lib.php

위 파일의 22라인을 수정하면 됩니다. 단, latest 함수를 사용하는 곳에 모두 적용됩니다.

$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by rand() limit 0, $rows ";
감사합니다~
좋아요 ㅎㅎ 감사요
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

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

+
제목 글쓴이 날짜 조회
14년 전 조회 1,260
14년 전 조회 4,126
14년 전 조회 2,522
14년 전 조회 1,521
14년 전 조회 2,164
14년 전 조회 959
14년 전 조회 1,530
14년 전 조회 1,554
14년 전 조회 1,536
14년 전 조회 1,681
14년 전 조회 1,517
14년 전 조회 1,519
14년 전 조회 1,534
14년 전 조회 1,890
14년 전 조회 1,604
14년 전 조회 1,546
14년 전 조회 1,517
14년 전 조회 1,536
14년 전 조회 5,493
14년 전 조회 1,645
🐛 버그신고