메인페이지 최신글 중복 출력되네요ㅠㅠ

2015-03-03 (화) 19:18:35 2,988

http://www.epohang.net/ 

메인페이지 최신글 세개가 하나만 출력 되어야 하는데 6개가 출력되네요. 도대체 어디를 손봐야 할까요. ㅠㅠ

|

답변 4개

2015-03-03 (화) 21:49:44

답변감사드립니다.

    <th><?php echo latest("basic", "002", 5, 30); ?></th>

    <th><?php echo latest("basic", "000", 5, 30); ?></th>
    <th><?php echo latest("basic", "005", 5, 30); ?></th>

002, 000, 005 이렇게 최신글 불러올 게시판을 지정하실 것이므로..

아래 부분은 필요가 없습니다. 지워주시면 됩니다.

<?php

//  최신글
# 그룹 기준 
$gr_where_sql =  "a.bo_device <> 'mobile' "; 
$gr_where_sql .= "and a.bo_list_level <= '{$member['mb_level']}' "; # 회원레벨에 따른 출력제한 
// $gr_where_sql .= "and a.bo_order != '0' "; # 게시판 출력순서 0  제외 
$gr_where_sql .= "and a.bo_use_search != '0' "; # 검색 미사용 제외 
$gr_where_sql .= "and b.gr_id not in ('admin','03','05') "; # 그룹 제외 '05', '06'... 
$gr_where_sql .= "and a.bo_table not in ('notice') "; #  테이블 제외 'notice', 'tbname' 
$gr_order .= " b.gr_order, "; # 그룹 출력순서에 따른 정렬 우선 
$sql = " select bo_table from `{$g5['board_table']}` a left join `{$g5['group_table']}` b on (a.gr_id=b.gr_id)  where $gr_where_sql order by $gr_order a.bo_order ";

// 테이블 기준 
/* 
$tb_where_sql =  "bo_device <> 'mobile' "; 
$tb_where_sql .= "and bo_list_level <= '{$member['mb_level']}' "; # 회원레벨에 따른 출력제한 
$tb_where_sql .= "and bo_order != '0' "; # 게시판 출력순서 0 출력 제외 
$tb_where_sql .= "and bo_table not in ('notice') "; # 제외 테이블  'notice', 'tbname' 
$sql = " select bo_table, bo_subject from {$g5[board_table]} where $tb_where_sql order by bo_order "; 
*/ 
$result = sql_query($sql); 
for ($i=0; $row=sql_fetch_array($result); $i++) { 
    if ($i%2==1) $lt_style = "margin-left:20px"; 
    else $lt_style = "";  

?> 

 

젤 아래의 아래 코드도 지워주시구요.

<?php

}

?>

2015-03-03 (화) 20:17:05

답변감사합니다.제가 어려워서 이해를 못했습니다

현재최신글 코딩은 이렇습니다.

<!-- 최신글 시작 { -->
<?php
//  최신글
# 그룹 기준
$gr_where_sql =  "a.bo_device <> 'mobile' ";
$gr_where_sql .= "and a.bo_list_level <= '{$member['mb_level']}' "; # 회원레벨에 따른 출력제한
// $gr_where_sql .= "and a.bo_order != '0' "; # 게시판 출력순서 0  제외
$gr_where_sql .= "and a.bo_use_search != '0' "; # 검색 미사용 제외
$gr_where_sql .= "and b.gr_id not in ('admin','03','05') "; # 그룹 제외 '05', '06'...
$gr_where_sql .= "and a.bo_table not in ('notice') "; #  테이블 제외 'notice', 'tbname'
$gr_order .= " b.gr_order, "; # 그룹 출력순서에 따른 정렬 우선
$sql = " select bo_table from `{$g5['board_table']}` a left join `{$g5['group_table']}` b on (a.gr_id=b.gr_id)  where $gr_where_sql order by $gr_order a.bo_order ";

// 테이블 기준
/*
$tb_where_sql =  "bo_device <> 'mobile' ";
$tb_where_sql .= "and bo_list_level <= '{$member['mb_level']}' "; # 회원레벨에 따른 출력제한
$tb_where_sql .= "and bo_order != '0' "; # 게시판 출력순서 0 출력 제외
$tb_where_sql .= "and bo_table not in ('notice') "; # 제외 테이블  'notice', 'tbname'
$sql = " select bo_table, bo_subject from {$g5[board_table]} where $tb_where_sql order by bo_order ";
*/
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
    if ($i%2==1) $lt_style = "margin-left:20px";
    else $lt_style = "";
?>
<table width="900" border="0" align="center">
  <tr>
    <th><?php echo latest("basic", "002", 5, 30); ?></th>
    <th><?php echo latest("basic", "000", 5, 30); ?></th>
    <th><?php echo latest("basic", "005", 5, 30); ?></th>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<?php
}
?>
<!-- } 최신글 끝 -->​

어렵네요 ㅠㅠ

반복문 안에서 latest 함수가 실행된듯 싶네요.

반복문 밖으로 빼셔서 실행하시기 바랍니다.

답변을 작성하려면 로그인이 필요합니다.