최근게시물을 랜덤출력하려고하는데용, 정보
최근게시물을 랜덤출력하려고하는데용,본문
소스는 메인에 이미지와 텍스트가 동시에 출력되게 되어있습니다.
제가 직접 제작한게 아니고 친구가 수정 좀 부탁해서요 ^^
이게 게시판에 추가된 체크박스(베스트상품)을 체크한 제품 최근순으로 출력되는 거거든요,
체크 상관없이요 그냥 그 게시판에 있는 게시물을 랜덤으로 출력하는 방법 좀 알려주세요 ^^
<?
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>
--------------------------------------------------------------
그냥 단순하게 테이블 반복해서 나오는거 같은데요,
이걸 랜덤으로 출력하려면 어떻게 해야하는지 도와주세요 ㅠ
제가 직접 제작한게 아니고 친구가 수정 좀 부탁해서요 ^^
이게 게시판에 추가된 체크박스(베스트상품)을 체크한 제품 최근순으로 출력되는 거거든요,
체크 상관없이요 그냥 그 게시판에 있는 게시물을 랜덤으로 출력하는 방법 좀 알려주세요 ^^
<?
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>
--------------------------------------------------------------
그냥 단순하게 테이블 반복해서 나오는거 같은데요,
이걸 랜덤으로 출력하려면 어떻게 해야하는지 도와주세요 ㅠ
댓글 전체

/lib/latest.lib.php
위 파일의 22라인을 수정하면 됩니다. 단, latest 함수를 사용하는 곳에 모두 적용됩니다.
$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by rand() limit 0, $rows ";
위 파일의 22라인을 수정하면 됩니다. 단, latest 함수를 사용하는 곳에 모두 적용됩니다.
$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by rand() limit 0, $rows ";
감사합니다~

좋아요 ㅎㅎ 감사요