리스트부분질문좀 드리겠습니다
본문
안녕하세요 질문좀 드리겠습니다
글쓰기 부분에서 여분필드를 줘서 리스트부분에서는 다르게 출력을 하게끔 만들었습니다.
프리미엄일때와 일반으로 2가지로 나눠놨는데
문제는 게시판 2페이지로 넘어갈시에 1페이지와 동일하게 내용만 다르게 출력이되는데
이런방식말고
페이지에서 프리미엄게시글이 우선적으로먼저 다나오구 그뒤에 일반게시글이 이어지게끔 하는방법은 없을까요 ?
예 ( 1페이지에 프리미엄이 40게시글일시 다출력 2페이지에서는 일반만나오게끔)
방법좀 아시는분계시면 도와주시면 감사하겠습니다
<div class="premium_box">
<?php
for ($i=0; $i<count($list); $i++) {
if($list[$i]['wr_8'] == '프리미엄'){//프리미엄일때
?>
<div class="premium_box_1"> <a href="<?php echo $list[$i]['href'] ?>">
<h1>
<a href="<?php echo $list[$i]['href'] ?>">
<?php
if ($list[$i]['is_notice']) { // 공지사항 ?>
<strong style="width:<?php echo $board['bo_gallery_width'] ?>px;height:<?php echo $board['bo_gallery_height'] ?>px">공지</strong>
<?php } else {
$thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height']);
if($thumb['src']) {
$img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'">';
} else {
$img_content = '<span style="width:'.$board['bo_gallery_width'].'px;height:'.$board['bo_gallery_height'].'px">no image</span>';
}
echo $img_content;
}
?>
</a>
</h1>
<p><?php echo $list[$i][wr_5]; ?></p>
<b><?php echo $list[$i][wr_subject]; ?></b>
</a>
</div>
<?}}?>
<div class="Basic_box_wrap">
<?php
for ($i=0; $i<count($list); $i++) {
if($list[$i]['wr_8'] == '일반'){//일반
?>
<div class="Basic_box">
<div class="Basic_box_1"><a href="<?php echo $list[$i]['href'] ?>">
<h1>
<?php
if ($list[$i]['is_notice']) { // 공지사항 ?>
<strong style="width:<?php echo $board['bo_gallery_width'] ?>px;height:<?php echo $board['bo_gallery_height'] ?>px">공지</strong>
<?php } else {
$thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height']);
if($thumb['src']) {
$img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'">';
} else {
$img_content = '<span style="width:'.$board['bo_gallery_width'].'px;height:'.$board['bo_gallery_height'].'px">no image</span>';
}
echo $img_content;
}
?>
</h1>
<div class="Basic_box_box">
<p><?php echo $list[$i][wr_5]; ?></p>
<h4><?php echo $list[$i][wr_subject]; ?></h4>
</div>
</a>
</div>
답변 2
(1페이지에 프리미엄이 40게시글일시 다출력 2페이지에서는 일반만나오게끔)
1page는 프리미엄 출력이 되는 것이고 2page는 출력이 안된다고 하시면
page를 체크하시면 간단한 문제인데요
<?
if($_get['page'] == 1 ){
echo "프리미엄 나온다";
}else{
echo "프리미엄 안나온다";
}
?>
공지가 상단에 나오고 하단에 일반 글이 나오는 것처럼 수정을 해야겠지요
보통은 공지가 나오면 해당 공지에 대한 번호를 다시 검색하지 않게 끔 설정된게
/bbs/list.php 페이지의 169~170줄입니다
이처럼 프리미엄 글로 선택된 녀석들을 공지처럼 적용을 시키면 될것 같습니다
그리고 글을
if(공지)
공지내용 뿌려주고
else if(프리미엄)
프리미엄 내용 뿔려주고
else
일반내용 뿌려주고
이러한 형태로 잡으시는게 더 편하실듯 싶네요
답변을 작성하시기 전에 로그인 해주세요.