제목 부분을 오름차순 내림차순으로 하려면 어떻게 해야 하나요?
본문
아래와 같이 했는데 안됩니다.
<div class="btn-group" role="group">
<button type="button" class="btn btn_b01 nofocus dropdown-toggle dropdown-toggle-empty dropdown-toggle-split p-1" data-toggle="dropdown" data-display="static" aria-haspopup="true" aria-expanded="false" title="게시물 정렬">
<?php
switch($sst) {
case 'wr_subject' : $sst_icon = 'history';
$sst_txt = '날짜순 정렬';
break;
case 'wr_datetime' : $sst_icon = 'history';
$sst_txt = '날짜순 정렬';
break;
case 'wr_hit' : $sst_icon = 'eye';
$sst_txt = '조회순 정렬';
break;
case 'wr_good' : $sst_icon = 'thumbs-o-up';
$sst_txt = '추천순 정렬';
break;
case 'wr_nogood' : $sst_icon = 'thumbs-o-down';
$sst_txt = '비추천순 정렬';
break;
default : $sst_icon = 'sort-numeric-desc';
$sst_txt = '게시물 정렬';
break;
}
?>
<i class="fa fa-<?php echo $sst_icon ?> fa-fw fa-md" aria-hidden="true"></i>
<span class="sr-only"><?php echo $sst_txt ?></span>
</button>
<div class="dropdown-menu dropdown-menu-right p-0 border-0 bg-transparent text-right">
<div class="btn-group-vertical bg-white border rounded py-1">
<?php echo str_replace('>', ' class="btn px-3 py-1 text-left" role="button">', subject_sort_link('wr_subject', $qstr2, 1)) ?>
제목순
</a>
<?php echo str_replace('>', ' class="btn px-3 py-1 text-left" role="button">', subject_sort_link('wr_datetime', $qstr2, 1)) ?>
날짜순
</a>
<?php echo str_replace('>', ' class="btn px-3 py-1 text-left" role="button">', subject_sort_link('wr_hit', $qstr2, 1)) ?>
조회순
</a>
<?php if($is_good) { ?>
<?php echo str_replace('>', ' class="btn px-3 py-1 text-left" role="button">', subject_sort_link('wr_good', $qstr2, 1)) ?>
추천순
</a>
<?php } ?>
<?php if($is_nogood) { ?>
<?php echo str_replace('>', ' class="btn px-3 py-1 text-left" role="button">', subject_sort_link('wr_nogood', $qstr2, 1)) ?>
비추천순
</a>
<?php } ?>
</div>
</div>
</div>
그리고
<div class="d-md-table-cell nw-6 pr-md-1"><?php echo subject_sort_link('wr_subject', $qstr2, 1) ?>제목</a></div>
답변 3
오름차순 내림차순 변수값을 전달해서 리스트에서 해당 쿼리로 리스트 소팅되도록 수정적용을 해야 합니다.
<?php echo subject_sort_link('wr_subject', $qstr2, 1) ?>
->
<?php echo subject_sort_link('wr_subject', $qstr2, 'asc') ?>
답변 감사합니다.