[그누보드] 그누보드 게시판 전체와 해당글 리스트 불러오기
게시판 출력이 필요할 때 사용하시면 되고,
페이징은 없습니다.
해당 글만 출력할 때 사용해도 됩니다.
[code]
<?php
include_once('./_common.php');
//출력 테이블
//$bo_table값이 없을때 사용
$bo_table = 'notice';
?>
<table class="table">
<thead>
<tr>
<th scope="col">글제목</th>
<th scope="col">글쓴이</th>
</tr>
</thead>
<tbody>
<?php $list = get_list($bo_table);
for($i = 0 ;$i < $list['cnt'];$i++){ ?>
<tr>
<td><a href="<?php echo get_pretty_url($bo_table, $list[$i]['wr_id'])?>" target="_self"><?php echo $list[$i]['wr_subject']?></a></td>
<td><?php echo $list[$i]['mb_id']?></td>
</tr>
<?php }?>
</tbody>
</table>
<?php
function get_list($target_board, $wr_id=""){
//게시판 전체를 불러올수 있는 함수
//공지와 페이징은 없음.
//wr_id를 넘기면 wr_id = '1'인 내용을 불러옴
//$list = get_default_list('notice', '1');
//해당리스트 전체를 불러옴
//$list = get_default_list('notice');
global $g5;
$write_table = $g5['write_prefix'].$target_board;
$wr_id == "" ? $AND_WRID = "" : $AND_WRID = "AND wr_id = '{$wr_id}'";
$sql = "SELECT * FROM {$write_table} WHERE wr_is_comment = '0' {$AND_WRID}";
$result = sql_query($sql);
//게시판 목록 갯수 담기
$list['cnt'] = sql_num_rows($result);
//게시판 내용 배열에 담기
while ($row = sql_fetch_array($result)){
$list[] = array(
'wr_id' => $row['wr_id'],
'ca_name' => $row['ca_name'],
'wr_subject' => $row['wr_subject'],
'wr_seo_title' => $row['wr_seo_title'],
'wr_content' => $row['wr_content'],
'wr_link1' => $row['wr_link1'],
'wr_link2' => $row['wr_link2'],
'mb_id' => $row['mb_id'],
'wr_name' => $row['wr_name'],
'wr_email' => $row['wr_email'],
'wr_homepage' => $row['wr_homepage'],
'wr_1' => $row['wr_1'],
'wr_2' => $row['wr_2'],
'wr_3' => $row['wr_3'],
'wr_4' => $row['wr_4'],
'wr_5' => $row['wr_5'],
'wr_6' => $row['wr_6'],
'wr_7' => $row['wr_7'],
'wr_8' => $row['wr_8'],
'wr_9' => $row['wr_9'],
'wr_10'=> $row['wr_10']
);
}
return $list;
}
?>
[/code]
댓글 4개
게시판 목록
개발자팁
질문은 QA에서 해주시기 바랍니다.
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 4916 | 웹서버 | 6년 전 | 2870 | ||
| 4915 | PHP |
|
6년 전 | 2187 | |
| 4914 | 웹서버 | 7년 전 | 1899 | ||
| 4913 | JavaScript | 7년 전 | 2601 | ||
| 4912 | node.js | 7년 전 | 3717 | ||
| 4911 | 기타 | 7년 전 | 4195 | ||
| 4910 | 기타 | 7년 전 | 2279 | ||
| 4909 | 기타 | 7년 전 | 1986 | ||
| 4908 | 기타 | 7년 전 | 2022 | ||
| 4907 | Mobile | 7년 전 | 2293 | ||
| 4906 | JavaScript | 7년 전 | 2294 | ||
| 4905 | 기타 | 7년 전 | 2274 | ||
| 4904 | jQuery | 7년 전 | 2522 | ||
| 4903 | PHP | 7년 전 | 5233 | ||
| 4902 | jQuery | 7년 전 | 5132 | ||
| 4901 | 기타 | 7년 전 | 2713 | ||
| 4900 | MySQL | 7년 전 | 4122 | ||
| 4899 | 기타 | 7년 전 | 2268 | ||
| 4898 | 웹서버 | 7년 전 | 2453 | ||
| 4897 | MySQL | 7년 전 | 2210 | ||
| 4896 | MySQL | 7년 전 | 2637 | ||
| 4895 | JavaScript | 7년 전 | 9776 | ||
| 4894 | 웹서버 | 7년 전 | 2368 | ||
| 4893 | 기타 | 7년 전 | 8323 | ||
| 4892 | jQuery | 7년 전 | 5690 | ||
| 4891 | 기타 | 7년 전 | 2839 | ||
| 4890 | PHP | 7년 전 | 3424 | ||
| 4889 | JavaScript | 7년 전 | 6378 | ||
| 4888 | MySQL | 7년 전 | 3140 | ||
| 4887 | MySQL | 7년 전 | 2769 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기