최신글에 대한 글제목, 글쓴이 이름, 글 쓴 날짜를 제대로 불러오고 싶습니다.
본문
<!-- 전체게시물 목록 시작 { -->
<div id="bo_list">
<div class="tbl_head01 tbl_wrap">
<table>
<thead>
<tr>
<th scope="col">게시판</th>
<th scope="col">제목</th>
<th scope="col">이름</th>
<th scope="col">날짜</th>
</tr>
</thead>
<tbody>
<?php
//echo '=============================================================';
//print_r($list);
//echo '=============================================================';
for ($i=0; $i<count($list); $i++)
{
$num = $total_count - ($page - 1) * $config['cf_page_rows'] - $i;
$bo_subject = mb_substr($list[$i]['bo_subject'],0,8,"utf-8"); // 게시판명 글자수
$wr_subject = get_text(cut_str($list[$i]['wr_subject'], 35)); // 게시물제목 글자수
?>
<tr>
<td class="td_board"><a href="<?php echo G5_BBS_URL ?>/board.php?bo_table=<?php echo $list[$i]['bo_table'] ?>"><?php echo $bo_subject ?></a></td>
<td class="td_subject"><?php echo date("m-d", strtotime($list[$i]['wr_datetime'])); ?></td>
<td class="td_name"><?php echo date("m-d", strtotime($list[$i]['wr_datetime'])); ?></td>
<td class="td_date"><?php echo date("m-d", strtotime($list[$i]['wr_datetime'])); ?> </td>
</tr>
<?php } ?>
<?php if ($i == 0)
echo '<tr><td colspan="'.$colspan.'" class="empty_table">게시물이 없습니다.</td></tr>';
?>
</tbody>
</table>
</div>
게시판 이름의 경우는 잘 불러오는데
글 제목, 글쓴이 부르는건 잘 모르겠고
글 쓴 날짜는 왜 저렇게 나오는걸까요??
무엇을 어떻게 고쳐야할지 감도 안잡히네요 ㅠㅠ
고수님들 도와주세요
!-->답변 2
...
for ($i=0; $i<count($list); $i++)
{
$num = $total_count - ($page - 1) * $config['cf_page_rows'] - $i;
$bo_subject = mb_substr($list[$i]['bo_subject'],0,8,"utf-8"); // 게시판명 글자수
$wr_subject = get_text(cut_str($list[$i]['wr_subject'], 35)); // 게시물제목 글자수
?>
<tr>
<td class="td_board"><a href="<?php echo G5_BBS_URL ?>/board.php?bo_table=<?php echo $list[$i]['bo_table'] ?>"><?php echo $bo_subject ?></a></td>
<td class="td_subject"><?php echo date("m-d", strtotime($list[$i]['wr_datetime'])); ?></td>
<td class="td_name"><?php echo date("m-d", strtotime($list[$i]['wr_datetime'])); ?></td>
<td class="td_date"><?php echo date("m-d", strtotime($list[$i]['wr_datetime'])); ?> </td>
</tr>
...
위와 같이 된 영역을
...
for ($i=0; $i<count($list); $i++)
{
$num = $total_count - ($page - 1) * $config['cf_page_rows'] - $i;
$bo_subject = mb_substr($list[$i]['bo_subject'],0,8,"utf-8"); // 게시판명 글자수
$wr_subject = get_text(cut_str($list[$i]['wr_subject'], 35)); // 게시물제목 글자수
?>
<tr>
<td class="td_board"><a href="<?php echo G5_BBS_URL ?>/board.php?bo_table=<?php echo $list[$i]['bo_table'] ?>"><?php echo $bo_subject ?></a></td>
<td class="td_subject"><?php echo $wr_subject ?></td>
<td class="td_name"><?php echo $list[$i]['wr_name']; ?></td>
<td class="td_date"><?php echo date("y-m-d", strtotime($list[$i]['wr_datetime'])); ?> </td>
</tr>
...
와 같이 변경해보세요
그누보드의 최근게시물 latest 를 이요해 호출하셨다면
<?=$list[$i]['name']?> // 이름
<?=$list[$i]['subject']?> // 제목
<?=$list[$i]['datetime']?> // 날짜
로 출력가능합니다.
답변을 작성하시기 전에 로그인 해주세요.