게시판리스트 새로운필드가 공지사항에선 안나오네요
본문
[code]<?php
include_once('../../../../common.php');
include_once(G5_LIB_PATH.'/thumbnail.lib.php');
/* 출력할 페이지 리스트 */
$sop = strtolower($sop);
if ($sop != 'and' && $sop != 'or')
$sop = 'and';
// 분류 선택 또는 검색어가 있다면
$stx = trim($stx);
if ($sca || $stx) {
$sql_search = get_sql_search($sca, $sfl, $stx, $sop);
// 가장 작은 번호를 얻어서 변수에 저장 (하단의 페이징에서 사용)
$sql = " select MIN(wr_num) as min_wr_num from {$write_table} ";
$row = sql_fetch($sql);
$min_spt = (int)$row['min_wr_num'];
if (!$spt) $spt = $min_spt;
$sql_search .= " and (wr_num between {$spt} and ({$spt} + {$config['cf_search_part']})) ";
// 원글만 얻는다. (코멘트의 내용도 검색하기 위함)
$sql = " select distinct wr_parent from {$write_table} where {$sql_search} ";
$result = sql_query($sql);
$total_count = mysql_num_rows($result);
} else {
$sql_search = "";
$total_count = $board['bo_count_write'];
}
if(G5_IS_MOBILE) {
$page_rows = $board['bo_mobile_page_rows'];
} else {
$page_rows = $board['bo_page_rows'];
}
if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
// 년도 2자리
$today2 = G5_TIME_YMD;
$list = array();
$i = 0;
$notice_count = 0;
$notice_array = array();
// 공지 처리
if (!$sca && !$stx && $pg==1 ) {
$arr_notice = explode(',', trim($board['bo_notice']));
for ($k=0; $k<count($arr_notice); $k++) {
if (trim($arr_notice[$k])=='') continue;
$row = sql_fetch(" select * from {$write_table} where wr_id = '{$arr_notice[$k]}' ");
if (!$row['wr_id']) continue;
if($page == 1) {
$list[$i] = get_list($row, $board, $board_skin_url, G5_IS_MOBILE ? $board['bo_mobile_subject_len'] : $board['bo_subject_len']);
$list[$i]['is_notice'] = true;
$i++;
}
$notice_array[] = $row['wr_id'];
$notice_count++;
}
}
$total_page = ceil($total_count / $page_rows); // 전체 페이지 계산
$from_record = ( $pg - 1) * $page_rows; // 시작 열을 구함
$nextPg = $pg + 1;
if($page > 1 && $notice_count)
$from_record -= $notice_count;
if($page == 1 && $notice_count)
$page_rows -= $notice_count;
// 관리자라면 CheckBox 보임
$is_checkbox = false;
if ($is_member && ($is_admin == 'super' || $group['gr_admin'] == $member['mb_id'] || $board['bo_admin'] == $member['mb_id']))
$is_checkbox = true;
// 정렬에 사용하는 QUERY_STRING
$qstr2 = 'bo_table='.$bo_table.'&sop='.$sop;
// 0 으로 나눌시 오류를 방지하기 위하여 값이 없으면 1 로 설정
$bo_gallery_cols = $board['bo_gallery_cols'] ? $board['bo_gallery_cols'] : 1;
$td_width = (int)(100 / $bo_gallery_cols);
// 정렬
// 인덱스 필드가 아니면 정렬에 사용하지 않음
//if (!$sst || ($sst && !(strstr($sst, 'wr_id') || strstr($sst, "wr_datetime")))) {
if (!$sst) {
if ($board['bo_sort_field']) {
$sst = $board['bo_sort_field'];
} else {
$sst = "wr_num, wr_reply";
$sod = "";
}
} else {
// 게시물 리스트의 정렬 대상 필드가 아니라면 공백으로 (nasca 님 09.06.16)
// 리스트에서 다른 필드로 정렬을 하려면 아래의 코드에 해당 필드를 추가하세요.
// $sst = preg_match("/^(wr_subject|wr_datetime|wr_hit|wr_good|wr_nogood)$/i", $sst) ? $sst : "";
$sst = preg_match("/^(wr_datetime|wr_hit|wr_good|wr_nogood|distance)$/i", $sst) ? $sst : "";
}
if ($sst) {
$sql_order = " order by {$sst} {$sod} ";
}
if ($sca || $stx) {
$sql = " select distinct wr_parent,( 6371 * acos( cos( radians(".$_SESSION['lat'].") ) * cos( radians( wr_9 ) ) * cos( radians( wr_10 ) - radians(".$_SESSION['lng'].") ) + sin( radians(".$_SESSION['lat'].") ) * sin( radians( wr_9 ) ) ) ) AS distance from {$write_table} where {$sql_search} {$sql_order} limit {$from_record}, $page_rows ";
// $sql = " select distinct wr_parent from {$write_table} where {$sql_search} {$sql_order} limit {$from_record}, $page_rows ";
} else {
// $sql = " select * from {$write_table} where wr_is_comment = 0 ";
// if ($sst == "distance"){
if ($_SESSION['lat'] != "" && $_SESSION['lng'] != ""){
$sql = " select *,( 6371 * acos( cos( radians(".$_SESSION['lat'].") ) * cos( radians( wr_9 ) ) * cos( radians( wr_10 ) - radians(".$_SESSION['lng'].") ) + sin( radians(".$_SESSION['lat'].") ) * sin( radians( wr_9 ) ) ) ) AS distance from {$write_table} where wr_is_comment = 0 ";
} else {
$sql = " select * from {$write_table} where wr_is_comment = 0 ";
}
if($notice_count && !empty($notice_array))
$sql .= " and wr_id not in (".implode(', ', $notice_array).") ";
$sql .= " {$sql_order} limit {$from_record}, $page_rows ";
}
//echo($sql);
$result = sql_query($sql);
$k = 0;
while ($row = sql_fetch_array($result))
{
// 검색일 경우 wr_id만 얻었으므로 다시 한행을 얻는다
if ($sca || $stx)
// $row = sql_fetch(" select * from {$write_table} where wr_id = '{$row['wr_parent']}' ");
$row = sql_fetch(" select *,( 6371 * acos( cos( radians(".$_SESSION['lat'].") ) * cos( radians( wr_9 ) ) * cos( radians( wr_10 ) - radians(".$_SESSION['lng'].") ) + sin( radians(".$_SESSION['lat'].") ) * sin( radians( wr_9 ) ) ) ) AS distance from {$write_table} where wr_id = '{$row['wr_parent']}' ");
$list[$i] = get_list($row, $board, $board_skin_url, G5_IS_MOBILE ? $board['bo_mobile_subject_len'] : $board['bo_subject_len']);
if (strstr($sfl, 'subject')) {
$list[$i]['subject'] = search_font($stx, $list[$i]['subject']);
}
$list[$i]['is_notice'] = false;
$list_num = $total_count - ($page - 1) * $page_rows;
if($page == 1)
$list_num -= $notice_count;
$list[$i]['num'] = $list_num - $k;
$i++;
$k++;
}
?>
<table>
<tbody>
<?php
for ($i=0; $i<count($list); $i++) {
?>
<tr class="<?php if ($list[$i]['is_notice']) echo "bo_notice"; ?>">
<?php if ($is_checkbox) { ?>
<td class="td_chk">
<label for="chk_wr_id_<?php echo $i ?>" class="sound_only"><?php echo $list[$i]['subject'] ?></label>
<input type="checkbox" name="chk_wr_id[]" value="<?php echo $list[$i]['wr_id'] ?>" id="chk_wr_id_<?php echo $i ?>">
</td>
<?php } ?>
<td class="td_image" style="width:<?php echo $board['bo_gallery_width'] ?>px; height:<?php echo $board['bo_gallery_height'] ?>px; padding:0">
<?php if ($list[$i]['is_notice']) { // 공지사항
$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 "<div style='font-weight: bold; font-size: 11px; background: #cc0000;color: #fff; text-align: center;position: absolute; width: 130px;'>PRIMIUM</div>";
echo "<a href='".$list[$i]['href']."'>".$img_content."</a>";
?>
<?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"><img src="'.$board_skin_url.'/img/no-image.jpg"></span>';
}
echo "<a href='".$list[$i]['href']."'>".$img_content."</a>";
}
?>
</td>
<td class="td_contents">
<div class="list-label" style="margin-top:-10px;">
<span style="margin-left:10px;"></span>
<?php if ($list[$i]['wr_18']) { ?>
<span class="blue"><?=$list[$i][wr_18]?></span>
<?php } ?>
<?php if ($list[$i]['wr_19']) { ?>
<span class="oren"><?=$list[$i][wr_19]?></span>
<?php } ?>
<?php if ($list[$i]['wr_20']) { ?>
<span class="red"><?=$list[$i][wr_20]?></span>
<?php } ?>
</div>
<div class="td_subject">
<div style="color:#909090; line-height:26px;">[<?=$list[$i][wr_1]?>]
<?
//거리표시
if ($list[$i]['distance'] != ""){
echo ("(".number_format($list[$i]['distance'],2)." km".")");
}
?></div>
<?php
echo $list[$i]['icon_reply'];
if ($is_category && $list[$i]['ca_name']) {
?>
<a href="<?php echo $list[$i]['ca_name_href'] ?>" class="bo_cate_link"><?php echo $list[$i]['ca_name'] ?></a>
<?php } ?>
<a href="<?php echo $list[$i]['href'] ?>">
<?php echo conv_subject($list[$i]['subject'],20) ?><!--
<?php if ($list[$i]['comment_cnt']) { ?><span class="sound_only">댓글</span><?php echo $list[$i]['comment_cnt']; ?><span class="sound_only">개</span><?php } ?> -->
</a>
</div>
<?
$num = ($list[$i][wr_3] / $list[$i][wr_2]) * 100;
$sale = 100 - number_format($num,"2") ;
?>
<?php if ($list[$i][wr_4]) { ?>
<div style="float:left; padding:0 10px;">
<?php echo cut_str(strip_tags($list[$i][wr_4]),65,"…");;?>
</div>
<div style="float:right; padding:3px 10px;">
<div class="good_btn"><?php echo $list[$i]['wr_good'] ?><br />좋아요</div>
<div style="text-align: center"><span class="no_3"><!-- <?=number_format($list[$i][wr_4])?><span class="no_4">개 --><!--<?php echo number_format($view['wr_hit']) ?>회</span>--></div>
</div>
<? } else {?>
<div style="float:left; padding:0 10px;">
<div style="width:60px; float:left; padding: 15px 0px;"><span class="sale"><?=number_format($sale);?><span class="sale_pe">%</span></span></div>
<div style="float:left; padding:2px 0;"><span class="no_1"><?=number_format($list[$i][wr_2])?>원</span><br />
<span class="no_2"><?=number_format($list[$i][wr_3])?><span class="no_5">원</span></span>
</div>
</div>
<div style="float:right; padding:0 10px;">
<div class="good_btn"><?php echo $list[$i]['wr_good'] ?><br />좋아요</div>
<div style="text-align: center;"><span class="no_3"><!-- <?=number_format($list[$i][wr_4])?><span class="no_4">개 --><!--<?php echo number_format($view['wr_hit']) ?>회</span>--></div>
</div>
<?php } ?>
</div>
</td>
</tr>
<tr>
<td colspan="3" style="height:5px; background:#dedede;"></td>
</tr>
<?php } ?>
</tbody>
</table>
<?if( $pg >= $total_page ){?>
<div class="m_more01 morebox" id="more2" ><span><img src="<?php echo $board_skin_url;?>/img/more_plus.png"> 더보기</span></div>
<?}else{?>
<div class="m_more01 morebox" id="more<?=$nextPg?>" onclick="addList(<?=$nextPg?>)"><span name="mc" id="<?=$nextPg?>"><img src="<?php echo $board_skin_url;?>/img/more_plus.png"> 더보기</span></div>
<?}?>
<!--더보기 클릭시로
<?if( $pg >= $total_page ){?>
<div class="m_more01 morebox" id="more2" ><span><img src="<?php echo $board_skin_url;?>/img/more_plus.png"> 더보기</span></div>
<?}else{?>
<div class="m_more01 morebox" id="more<?=$nextPg?>" onclick="addLi
답변 1
페이지가 너무길어서 다 보지못하였지만..
중간중간에 echo 로 찍어보면서
아예 새로운 필드가 안찍히는건지
아니면 찍히다가 어디부분에서 사라지는것인지를
찾는게 빠를듯합니다..ㅠㅠ