오름차순 내림차순 설정방법..
본문
https://sir.kr/g5_skin/16421?sfl=wr_subject%7C%7Cwr_content&stx=%EC%97%B0%ED%98%81
위 연혁 스킨을 사용중입니다.
현재는 이렇게
1월
8월
11월 순으로 정렬이 되는데
11월
8월
1월
순으로 정렬이 되게 하려면 어떻게 해야할까요?
일반 게시판이라면 관리자설정에서 설정할 수 있던데 이게시판은 좀 보통게시판과는 다른속성인것 같아서... 질문드립니다!
list_skin.php 파일에서
게시글 목록 부분 가져와봤습니다 ㅠㅠ
<head><style>
.history_date: {
color:crimson;
font-weight:bold;
}
</style>
</head>
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
include_once(G5_LIB_PATH.'/thumbnail.lib.php');
include_once $board_skin_path."/board_head.skin.php";
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/css/style.css">', 20);
add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/css/lightbox.css">', 21);
?>
<div class="sub_con widthfix">
<div class="history_div mt55">
<form name="fboardlist" id="fboardlist" action="./board_list_update.php" onsubmit="return fboardlist_submit(this);" method="post">
<input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
<input type="hidden" name="sfl" value="<?php echo $sfl ?>">
<input type="hidden" name="stx" value="<?php echo $stx ?>">
<input type="hidden" name="spt" value="<?php echo $spt ?>">
<input type="hidden" name="page" value="<?php echo $page ?>">
<input type="hidden" name="sw" value="">
<!-- 게시판 목록 시작 -->
<?
$sql = "SELECT * FROM $write_table ORDER BY wr_subject $board[bo_4], wr_1, wr_2 ";
$result=sql_query($sql);
//$num_rows = mysql_num_rows($result);
$count = 0;
while($data=sql_fetch_array($result)) {
$count++;
$hList[]=$data;
if($preYear != $data[wr_subject]) {
$preYear = $data[wr_subject];
if($count > 1) {
$cicle_img = '<div class="year_body"><span>'.$data[wr_subject].'</span></div>';
}elseif($count == 1){
$cicle_img = '<div class="year_body first"><span>'.$data[wr_subject].'</span></div>';
}
echo ' <div class="p_box '.$margin_top.'">';
echo ' <div class="history_img">'.$cicle_img.'</div>';
echo ' <div class="history_txt">';
$tmp_write_table = $g5['write_prefix'] . $board['bo_table']; // 게시판 테이블 전체이름
$sql_detail = " select * from {$tmp_write_table} where wr_subject = {$data[wr_subject]} order by wr_subject $board[bo_4], wr_1, wr_2 ";
$result_detail = sql_query($sql_detail);
$history_icon = '';
for ($i=0; $hList = sql_fetch_array($result_detail); $i++) {
if($i == 0) {
if($i > -1) $margin_top = "mt30";
echo '<div class="tit">';
echo ' <h4>'.$hList[wr_subject].'</h4>';
echo '</div>';
}
$disp_month = $hList[wr_1];
$disp_day = $hList[wr_2];
if($board[bo_3]=="d") {
$display = '<span class="history_date">'.$disp_month."월 ".($disp_day == '00' ? "" : $disp_day."일. ").'</span>';
}else{
$display = $disp_month."월";
}
echo '<p class="mt5">';
if($is_admin || $is_checkbox) echo '<input type="checkbox" name="chk_wr_id[]" value="'.$hList[wr_id].'" title="'.$hList[wr_subject].'"> ';
if($is_admin) {
echo ' <a href="'.G5_BBS_URL.'/write.php?bo_table='.$bo_table.'&w=u&wr_id='.$hList[wr_id].'">';
}
echo $display.rtrim(nl2br($hList[wr_content]));
if ($is_admin)
{
set_session("ss_delete_token", $token = uniqid(time()));
$delete_href ='./delete_all.php?bo_table='.$bo_table.'&wr_id='.$hList[wr_id];
echo ' </a> ';
echo '<a href="javascript:del(\''.$delete_href.'\');"><img src="'.$board_skin_url.'/img/btn_close.gif" alt="Delete" width="12px" height="11px" /></a>';
}
echo '</p>';
$thumb = get_list_thumbnail($bo_table, $hList['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height']);
$sql = " select bf_file, bf_content from {$g5['board_file_table']}
where bo_table = '$bo_table' and wr_id = '$hList[wr_id]' and bf_type between '1' and '3' order by bf_no limit 0, 1 ";
$row = sql_fetch($sql);
if($thumb['src']) {
$history_icon .= '<div class="history_icon">';
$history_icon .= '<strong>'.$hList[wr_subject].'</strong>';
$history_icon .= '<p class="tit">'.$thumb['alt'].'</p>';
$history_icon .= '<p class="mt5"><a href="'.G5_DATA_URL.'/file/'.$bo_table.'/'.$row['bf_file'].'" data-lightbox="history-image-set" class="light-box-image"><img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" width="'.$board['bo_gallery_width'].'" height="'.$board['bo_gallery_height'].'"></a></p>';
$history_icon .= '</div>';
}
}
echo ' </div>';
echo $history_icon;
echo ' </div>';
}
}
?>
<div class="p_box">
<div class="history_img"><img src="<?=$board_skin_url?>/img/history_start.gif" style="position:absolute;bottom:0;left:145px;" alt="history_start"></div>
<div class="history_txt">
</div>
</div>
</div>
<div class="mt40"></div>
<?php if ($is_admin || $list_href || $is_checkbox || $write_href) { ?>
<div class="bo_fx">
<?php if ($is_checkbox) { ?>
<ul class="btn_bo_adm">
<li><input type="submit" name="btn_submit" value="선택삭제" onclick="document.pressed=this.value"></li>
<li><input type="submit" name="btn_submit" value="선택복사" onclick="document.pressed=this.value"></li>
<li><input type="submit" name="btn_submit" value="선택이동" onclick="document.pressed=this.value"></li>
</ul>
<?php } ?>
<?php if ($list_href || $rss_href || $write_href) { ?>
<ul class="btn_bo_user">
<?php if ($rss_href) { ?><li><a href="<?php echo $rss_href ?>" class="btn_b01">RSS</a></li><?php } ?>
<?php if ($admin_href) { ?><li><a href="<?php echo $admin_href ?>" class="btn_admin">관리자</a></li><?php } ?>
<?php if ($list_href) { ?><li><a href="<?php echo $list_href ?>" class="btn_b01">목록</a></li><?php } ?>
<?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="btn_b02">글쓰기</a></li><?php } ?>
</ul>
<?php } ?>
</div>
<?php } ?>
</form>
<!-- 페이지 -->
<?php //echo $write_pages; ?>
</div>
<script type="text/javascript">
var num = 0;
jQuery(document).ready(function(){
jQuery(".history_img");
jQuery(".history_txt");
$(".history_icon");
})
jQuery(window).load(function(){
jQuery(".history_img").each(function(index){
jQuery.easing.def = "easeOutQuart";
num++;
jQuery(".history_img").eq(index).delay().animate({opacity:100, marginTop:"0px"}, 900);
jQuery(".history_txt").eq(index).delay().animate({opacity:100, marginTop:"0px"}, 900);
$(".history_icon").eq(index).delay().animate({opacity:100, marginTop:"0px"}, 600);
})
})
</script>
<script type="text/javascript">
if ('<?=$sca?>') document.fcategory.sca.value = '<?=$sca?>';
/*
if ('<?=$stx?>') {
document.fsearch.sfl.value = '<?=$sfl?>';
if ('<?=$sop?>' == 'and')
document.fsearch.sop[0].checked = true;
if ('<?=$sop?>' == 'or')
document.fsearch.sop[1].checked = true;
} else {
document.fsearch.sop[0].checked = true;
}
*/
</script>
<?php if ($is_checkbox) { ?>
<script>
function all_checked(sw) {
var f = document.fboardlist;
for (var i=0; i<f.length; i++) {
if (f.elements[i].name == "chk_wr_id[]")
f.elements[i].checked = sw;
}
}
function fboardlist_submit(f) {
var chk_count = 0;
for (var i=0; i<f.length; i++) {
if (f.elements[i].name == "chk_wr_id[]" && f.elements[i].checked)
chk_count++;
}
if (!chk_count) {
alert(document.pressed + "할 게시물을 하나 이상 선택하세요.");
return false;
}
if(document.pressed == "선택복사") {
select_copy("copy");
return;
}
if(document.pressed == "선택이동") {
select_copy("move");
return;
}
if(document.pressed == "선택삭제") {
if (!confirm("선택한 게시물을 정말 삭제하시겠습니까?\n\n한번 삭제한 자료는 복구할 수 없습니다"))
return false;
}
return true;
}
// 선택한 게시물 복사 및 이동
function select_copy(sw) {
var f = document.fboardlist;
if (sw == "copy")
str = "복사";
else
str = "이동";
var sub_win = window.open("", "move", "left=50, top=50, width=500, height=550, scrollbars=1");
f.sw.value = sw;
f.target = "move";
f.action = "./move.php";
f.submit();
}
</script>
<?php } ?>
<!-- } 게시판 목록 끝 -->
<script type="text/javascript" src="<?php echo $board_skin_url ?>/js/lightbox-2.6.min.js"></script>
감사합니다
주말 마무리 다들 잘하십시오!
!-->답변 2
여기에 desc 붙여보세요.
$sql_detail = " select * from {$tmp_write_table} where wr_subject = {$data[wr_subject]} order by wr_subject $board[bo_4], wr_1 desc, wr_2 ";
직접 입력 가능하신 거라면 코드 안건드리고 순서를 반대로 입력하시는 방법도 가능하지 않을까요?
답변을 작성하시기 전에 로그인 해주세요.