갤러리게시판에 있는 게시물을 랜덤으로
최근 게시물에 뿌리고 싶습니다.
latest.skin.php에 어디를 손봐야 하나요.
초보라 죄송합니다.
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$arr_new_cols=3; //한 줄에 출력할 이미지 개수
$imgwidth = 300; //이미지 가로사이즈
$imgheigh = 200; //이미지 세로사이즈
$tablewidth = 1000; // 전체테이블사이즈
$top_title = 최강통합갤러리; // 상단제목 설정하세요
$data_path = $g4[path]."/data/file";
$thumb_path = $data_path."/thumb/"; //불당썸네일 경로
?>
<style type="text/css">
BODY,TD,SELECT,input,form,TEXTAREA,center,option,pre,blockquote,span {font-size:9pt; font-family:나눔고딕; color:#666666;line-height:140%;}
a {selector-dummy: expression(this.hideFocus=true);}
A:link {color:666666;text-decoration:none;}
A:visited {color:666666;text-decoration:none;}
A:active {color:666666;text-decoration:none;}
A:hover {color:30C0FF;text-decoration:none;}
.sml8 {font-size:8pt; font-family:돋움; color:#2080D0; letter-spacing:-1;line-height:140%;};
</style>
<script language="javascript" src="<?=$latest_skin_path?>/img/common.js"></script>
<script language="javascript" src="<?=$latest_skin_path?>/img/viewTitle.js" type="text/javascript"></script>
<table width="<?=$tablewidth?>" border=0 cellspacing=0 cellpadding=0 align=center>
<tr><td><img src=<?=$latest_skin_path?>/img/bul2.gif align=absmiddle>
<script type="text/javascript">showTitle("", "<?=$latest_skin_path?>/img/viewTitle2.swf", 550, 30, "<?=$top_title?>", "", "left", "0x343434");</script>
</td></td></tr>
<tr>
<td height=13 background=<?=$latest_skin_path?>/img/title_bg.gif></td>
</tr>
</table>
<br>
<table width="<?=$tablewidth?>" cellpadding=0 cellspacing=0 style="margin-top:7px;" align=center>
<tr>
<?
for ($i=0; $i<count($list); $i++) {
if ($i >= 0)
$title = get_text($list[$i][subject]);
//한 줄에 $arr_new_cols 만큼 출력
if($i%$arr_new_cols == 0 && $i>0)
echo "</tr><tr>";
$content = cut_str(get_text($list[$i][wr_content]), 80);
$bo_table=$board_list[$i][bo_table];
$image = urlencode($list[$i][file][0][file]); //이미지파일명
$thumb = $data_path."/".$bo_table."/".$image;
echo <<<HEREDOC
<td align='center'>
<a href='{$list[$i][href]}' >
<img src='$thumb' border='0' title='$title' class="img" width='$imgwidth' height='$imgheigh'></a>
<div><span class=sml8><a href=$g4[path]/bbs/board.php?bo_table={$board_list[$i][bo_table]}>[{$board_list[$i][bo_subject]}]</a></span><br><a href='{$list[$i][href]}' >{$subject} {$title}</a> {$list[$i][icon_new]}</div><br>
</td>
HEREDOC;
}
/* end for */
?>
<? if (count($list) == 0) { ?><td align=center height=50><font color=#6A6A6A>게시물이 없습니다.</a></td><? } ?>
</tr>
</table>
최근 게시물에 뿌리고 싶습니다.
latest.skin.php에 어디를 손봐야 하나요.
초보라 죄송합니다.
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
$arr_new_cols=3; //한 줄에 출력할 이미지 개수
$imgwidth = 300; //이미지 가로사이즈
$imgheigh = 200; //이미지 세로사이즈
$tablewidth = 1000; // 전체테이블사이즈
$top_title = 최강통합갤러리; // 상단제목 설정하세요
$data_path = $g4[path]."/data/file";
$thumb_path = $data_path."/thumb/"; //불당썸네일 경로
?>
<style type="text/css">
BODY,TD,SELECT,input,form,TEXTAREA,center,option,pre,blockquote,span {font-size:9pt; font-family:나눔고딕; color:#666666;line-height:140%;}
a {selector-dummy: expression(this.hideFocus=true);}
A:link {color:666666;text-decoration:none;}
A:visited {color:666666;text-decoration:none;}
A:active {color:666666;text-decoration:none;}
A:hover {color:30C0FF;text-decoration:none;}
.sml8 {font-size:8pt; font-family:돋움; color:#2080D0; letter-spacing:-1;line-height:140%;};
</style>
<script language="javascript" src="<?=$latest_skin_path?>/img/common.js"></script>
<script language="javascript" src="<?=$latest_skin_path?>/img/viewTitle.js" type="text/javascript"></script>
<table width="<?=$tablewidth?>" border=0 cellspacing=0 cellpadding=0 align=center>
<tr><td><img src=<?=$latest_skin_path?>/img/bul2.gif align=absmiddle>
<script type="text/javascript">showTitle("", "<?=$latest_skin_path?>/img/viewTitle2.swf", 550, 30, "<?=$top_title?>", "", "left", "0x343434");</script>
</td></td></tr>
<tr>
<td height=13 background=<?=$latest_skin_path?>/img/title_bg.gif></td>
</tr>
</table>
<br>
<table width="<?=$tablewidth?>" cellpadding=0 cellspacing=0 style="margin-top:7px;" align=center>
<tr>
<?
for ($i=0; $i<count($list); $i++) {
if ($i >= 0)
$title = get_text($list[$i][subject]);
//한 줄에 $arr_new_cols 만큼 출력
if($i%$arr_new_cols == 0 && $i>0)
echo "</tr><tr>";
$content = cut_str(get_text($list[$i][wr_content]), 80);
$bo_table=$board_list[$i][bo_table];
$image = urlencode($list[$i][file][0][file]); //이미지파일명
$thumb = $data_path."/".$bo_table."/".$image;
echo <<<HEREDOC
<td align='center'>
<a href='{$list[$i][href]}' >
<img src='$thumb' border='0' title='$title' class="img" width='$imgwidth' height='$imgheigh'></a>
<div><span class=sml8><a href=$g4[path]/bbs/board.php?bo_table={$board_list[$i][bo_table]}>[{$board_list[$i][bo_subject]}]</a></span><br><a href='{$list[$i][href]}' >{$subject} {$title}</a> {$list[$i][icon_new]}</div><br>
</td>
HEREDOC;
}
/* end for */
?>
<? if (count($list) == 0) { ?><td align=center height=50><font color=#6A6A6A>게시물이 없습니다.</a></td><? } ?>
</tr>
</table>
댓글 3개
만약 최신글을 얻으신후 랜덤으로 돌리시려면
$rand_array = range( 0 , count($list));
shuffle($rand_array);
for ($n=0; $n<count($list); $n++) {
$i = $rand_array[$n];
으로 $i 값을 변경해 주시던가요
아니면 전체글에서 랜덤을 찾으시러면
lib/latest.lib.php 에
$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_num limit 0, $rows ";
이분부의 order by 부분을
$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by rand() limit 0, $rows ";
를 쓰시면 되고요
이렇게 하시면 테이블에 내용이 많아 지면 많이 느려지십니다
$rand_array = range( 0 , count($list));
shuffle($rand_array);
for ($n=0; $n<count($list); $n++) {
$i = $rand_array[$n];
으로 $i 값을 변경해 주시던가요
아니면 전체글에서 랜덤을 찾으시러면
lib/latest.lib.php 에
$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_num limit 0, $rows ";
이분부의 order by 부분을
$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by rand() limit 0, $rows ";
를 쓰시면 되고요
이렇게 하시면 테이블에 내용이 많아 지면 많이 느려지십니다
게시글 목록
| 번호 | 제목 |
|---|---|
| 284255 | |
| 284248 | |
| 284247 | |
| 284246 | |
| 284242 | |
| 284238 | |
| 284234 | |
| 284233 | |
| 284229 | |
| 284224 | |
| 284222 | |
| 284215 | |
| 284213 | |
| 284212 | |
| 284209 | |
| 284208 | |
| 284201 | |
| 284193 | |
| 284192 | |
| 284174 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기