일정제목 리스트 갯수를 숫자로만 표기가 가능한가요?

일정제목 리스트 갯수를 숫자로만 표기가 가능한가요?

QA

일정제목 리스트 갯수를 숫자로만 표기가 가능한가요?

본문

 

테스트 서버 : https://topnon2024.cafe24.com/

여러모로 달력을 해결하는 중입니다.


       

 

관리자만 사용할 것이구요 일정 등록(제목)이 2개면 -> 숫자로만 "2" 노출할 수 있는 방법이 있나요??

아래 이미지 첨부합니다.

2040635575_1707354126.1912.jpg

 

 

for문 카운트쪽에서 하라고는 하시는데 이해가 잘 안갑니다.

그리고 검색해서 아래걸 적용이 가능한지도 의문입니다.

 

<?php$sql ="select count(wr_subject) as cnt, wr_subject from g5_write_med_log where wr_is_comment = 0  and mb_id = 'mb_id' group by wr_subject"; // 제목별로 갯수를 구하는 쿼리문
$result = sql_query($sql);

?>

이 질문에 댓글 쓰기 :

답변 3


<?php if($do_cnt > 0) { ?>
<div class="media-body">
<ul class="do-list">
<?php for($i = 0; $i < $do_cnt; $i++) {
// 링크이동
$list[$cday][$i]['target'] = '';
if($is_link_target && $list[$cday][$i]['wr_link1']) {
$list[$cday][$i]['target'] = $is_link_target;
$list[$cday][$i]['href'] = $list[$cday][$i]['link_href'][1];
}
?>
<li>
<a href="<?php echo $list[$cday][$i]['href'];?>"<?php echo $list[$cday][$i]['target'];?><?php echo $is_modal_js;?>>
<span<?php echo ($list[$cday][$i]['wr_3']) ? ' class="'.$list[$cday][$i]['wr_3'].'"' : '';?>>
<?php echo apms_fa($list[$cday][$i]['as_icon']);?>
<?php echo $list[$cday][$i]['subject'] ;?>
</span>
<?php if($list[$cday][$i]['wr_comment']) { ?>
<span class="count orangered"><?php echo $list[$cday][$i]['wr_comment'];?></span>
<?php } ?>
</a>
</li>
<?php } ?>

 

위에 부분을 아래와 같이 수정하세요.


<?php if($do_cnt > 0) { ?>
<div class="media-body">
<ul class="do-list">
<?php echo $do_cnt; ?>
</ul>
</div>
<?php } ?>

아 js 기반이 아니라 그누보드를 달력모양을 하신거면 말씀하신것처럼

select 쿼리를 이용해서 카운트 한걸 아래에 넣으시면 됩니다.

select count(*) from ddd1 where  wr_iscomment = 0 and 날짜조건

이런식으로 하셔서 나온 카운트를 넣으시면 됩니다.

select count(*) from ddd1 where  wr_iscomment = 0 and 날짜조건
이런식으로 하셔서 나온 카운트를 어느곳에 넣어야 되는지요? ㅠ 초보라 여간 어렵네요.

<?php$sql ="select count(wr_subject) as cnt, wr_subject from ddd1 where wr_is_comment = 0  and mb_id = 'mb_id' group by wr_subject"; // 제목별로 갯수를 구하는 쿼리문
$result = sql_query($sql);
?>

표시하신 부분 php 코드 올려주세요

<div class="list-head div-head">
<span class="red">일요일</span>
<span>월요일</span>
<span>화요일</span>
<span>수요일</span>
<span>목요일</span>
<span>금요일</span>
<span class="blue">토요일</span>
</div>
<ul class="list-body">
<?php
$cday = 1;
$sel_mon = sprintf("%02d",$month);
$now_month = $year.$sel_mon;
$sca_sql = ($sca) ? "and ca_name = '".$sca."'" : "";
$result = sql_query("select * from $write_table where wr_is_comment = '0' and left(wr_1,6) <= '{$now_month}' and left(wr_2,6) >= '{$now_month}' $sca_sql order by wr_id asc");
while ($row = sql_fetch_array($result)) {

$start_day = (substr($row['wr_1'],0,6) <  $now_month) ? 1 : substr($row['wr_1'],6,2);
$start_day= (int)$start_day;

$end_day = (substr($row['wr_2'],0,6) >  $now_month) ? $lastday[$month] : substr($row['wr_2'],6,2);
$end_day= (int)$end_day;

$row2 = get_list($row, $board, $board_skin_url, G5_IS_MOBILE ? $board['bo_mobile_subject_len'] : $board['bo_subject_len']);

for ($i = $start_day; $i <= $end_day; $i++) {
$list[$i][] = $row2;
}
}

$temp = 7 - (($lastday[$month]+$dayoftheweek)%7);

if($temp == 7) $temp = 0;

$lastcount = $lastday[$month]+$dayoftheweek + $temp;

for ($iz = 1; $iz <= $lastcount; $iz++) {

$is_today = ($b_year == $year && $b_mon == $month && $b_day == $cday) ? true : false;

$daycolor = ' black';
$bg_daycolor = ' bg-black';

$dayweek = $iz%7;
if($dayweek == 1) {
echo '<li class="list-item">'.PHP_EOL;
$daycolor = ' red';
$bg_daycolor = ' bg-red';
} else if($dayweek == 0) {
$daycolor = ' blue';
$bg_daycolor = ' bg-blue';
}

$monthp = (strlen($month) == 1)? "0".$month:$month;
$cdayp = (strlen($cday) == 1)? "0".$cday:$cday;
$memday = $monthp.$cdayp;

$cf_anniversary = trim($wset['anniversary']);
$tooltip = '';
$bg_event = '';
$is_anniversary = false;
if ($cf_anniversary) {
$pattern = explode("\n", $cf_anniversary);
for ($s=0; $s<count($pattern); $s++) {

$anniversary = explode("|", $pattern[$s]);
if($anniversary[0] == $memday){
$daycolor = ($anniversary[2])?' '.$anniversary[2]:' red';
$tooltip = ' data-original-title="<nobr>'.$anniversary[1].'</nobr>" data-toggle="tooltip" data-placement="bottom" data-html="true"';
$is_anniversary = true;
$bg_event = ' bg-event';
}

}
}

//음력날짜
$myarray = soltolun($year,$month,$cday);

$daytext = ($is_today) ? '<span class="font-14 '.$tcolor.' en"><i class="fa fa-calendar-check-o fa-lg"></i> Today</span>' : $cday;

$do_cnt = count($list[$cday]);

if($dayoftheweek < $iz && $iz <= $lastday[$month]+$dayoftheweek) {
$fr_date = $year.sprintf("%02d",$month).sprintf("%02d",$cday);
?>
<div class="media<?php echo ($is_today) ? ' bg-today' : '';?> no-margin<?php echo $bg_event;?>">
<a class="media-date"<?php echo ($write_href) ? ' href="'.$write_href.'&amp;fr_date='.$fr_date.'&amp;to_date='.$fr_date.$sca_qstr.'"' : '';?>>
<span class="pull-left font-14 en<?php echo $daycolor;?>" <?php echo $tooltip;?>>
<span class="">
<?php echo $daytext;?>
</span>
<!--<span class="visible-xs"><?php// echo $month;?>.<?php// echo sprintf("%02d",$cday);?>(<?php// echo $yoil[$dayweek];?>)</span>-->
</span>
<?php if($is_lunar && ($is_today || $is_anniversary)){ ?><span class="pull-right  black font-12"><?php echo $myarray['month'].'.'.$myarray['day'];?></span><?php } ?>
</a>
<?php if($do_cnt > 0) { ?>
<div class="media-body">
<ul class="do-list">
<?php for($i = 0; $i < $do_cnt; $i++) {
// 링크이동
$list[$cday][$i]['target'] = '';
if($is_link_target && $list[$cday][$i]['wr_link1']) {
$list[$cday][$i]['target'] = $is_link_target;
$list[$cday][$i]['href'] = $list[$cday][$i]['link_href'][1];
}
?>
<li>
<a href="<?php echo $list[$cday][$i]['href'];?>"<?php echo $list[$cday][$i]['target'];?><?php echo $is_modal_js;?>>
<span<?php echo ($list[$cday][$i]['wr_3']) ? ' class="'.$list[$cday][$i]['wr_3'].'"' : '';?>>
<?php echo apms_fa($list[$cday][$i]['as_icon']);?>
<?php echo $list[$cday][$i]['subject'] ;?>
</span>
<?php if($list[$cday][$i]['wr_comment']) { ?>
<span class="count orangered"><?php echo $list[$cday][$i]['wr_comment'];?></span>
<?php } ?>
</a>
</li>
<?php } ?>
</ul>
</div>
<?php } ?>
</div>
<?php
$cday++;
} else {
echo '<div class=""></div>'.PHP_EOL;
}

if($iz%7 == 0) echo '</li>'.PHP_EOL;
}
?>
</ul>


<div class="list-head div-head">
<span class="red">일요일</span>
<span>월요일</span>
<span>화요일</span>
<span>수요일</span>
<span>목요일</span>
<span>금요일</span>
<span class="blue">토요일</span>
</div>
<ul class="list-body">
<?php
$cday = 1;
$sel_mon = sprintf("%02d",$month);
$now_month = $year.$sel_mon;
$sca_sql = ($sca) ? "and ca_name = '".$sca."'" : "";
$result = sql_query("select * from $write_table where wr_is_comment = '0' and left(wr_1,6) <= '{$now_month}' and left(wr_2,6) >= '{$now_month}' $sca_sql order by wr_id asc");
while ($row = sql_fetch_array($result)) {

$start_day = (substr($row['wr_1'],0,6) <  $now_month) ? 1 : substr($row['wr_1'],6,2);
$start_day= (int)$start_day;

$end_day = (substr($row['wr_2'],0,6) >  $now_month) ? $lastday[$month] : substr($row['wr_2'],6,2);
$end_day= (int)$end_day;

$row2 = get_list($row, $board, $board_skin_url, G5_IS_MOBILE ? $board['bo_mobile_subject_len'] : $board['bo_subject_len']);

for ($i = $start_day; $i <= $end_day; $i++) {
$list[$i][] = $row2;
}
}

$temp = 7 - (($lastday[$month]+$dayoftheweek)%7);

if($temp == 7) $temp = 0;

$lastcount = $lastday[$month]+$dayoftheweek + $temp;

for ($iz = 1; $iz <= $lastcount; $iz++) {

$is_today = ($b_year == $year && $b_mon == $month && $b_day == $cday) ? true : false;

$daycolor = ' black';
$bg_daycolor = ' bg-black';

$dayweek = $iz%7;
if($dayweek == 1) {
echo '<li class="list-item">'.PHP_EOL;
$daycolor = ' red';
$bg_daycolor = ' bg-red';
} else if($dayweek == 0) {
$daycolor = ' blue';
$bg_daycolor = ' bg-blue';
}

$monthp = (strlen($month) == 1)? "0".$month:$month;
$cdayp = (strlen($cday) == 1)? "0".$cday:$cday;
$memday = $monthp.$cdayp;

$cf_anniversary = trim($wset['anniversary']);
$tooltip = '';
$bg_event = '';
$is_anniversary = false;
if ($cf_anniversary) {
$pattern = explode("\n", $cf_anniversary);
for ($s=0; $s<count($pattern); $s++) {

$anniversary = explode("|", $pattern[$s]);
if($anniversary[0] == $memday){
$daycolor = ($anniversary[2])?' '.$anniversary[2]:' red';
$tooltip = ' data-original-title="<nobr>'.$anniversary[1].'</nobr>" data-toggle="tooltip" data-placement="bottom" data-html="true"';
$is_anniversary = true;
$bg_event = ' bg-event';
}

}
}

//음력날짜
$myarray = soltolun($year,$month,$cday);

$daytext = ($is_today) ? '<span class="font-14 '.$tcolor.' en"><i class="fa fa-calendar-check-o fa-lg"></i> Today</span>' : $cday;

$do_cnt = count($list[$cday]);

if($dayoftheweek < $iz && $iz <= $lastday[$month]+$dayoftheweek) {
$fr_date = $year.sprintf("%02d",$month).sprintf("%02d",$cday);
?>
<div class="media<?php echo ($is_today) ? ' bg-today' : '';?> no-margin<?php echo $bg_event;?>">
<a class="media-date"<?php echo ($write_href) ? ' href="'.$write_href.'&amp;fr_date='.$fr_date.'&amp;to_date='.$fr_date.$sca_qstr.'"' : '';?>>
<span class="pull-left font-14 en<?php echo $daycolor;?>" <?php echo $tooltip;?>>
<span class="">
<?php echo $daytext;?>
</span>
<!--<span class="visible-xs"><?php// echo $month;?>.<?php// echo sprintf("%02d",$cday);?>(<?php// echo $yoil[$dayweek];?>)</span>-->
</span>
<?php if($is_lunar && ($is_today || $is_anniversary)){ ?><span class="pull-right  black font-12"><?php echo $myarray['month'].'.'.$myarray['day'];?></span><?php } ?>
</a>
<?php /*if($do_cnt > 0) { ?>
<div class="media-body">
<ul class="do-list">
<?php for($i = 0; $i < $do_cnt; $i++) {
// 링크이동
$list[$cday][$i]['target'] = '';
if($is_link_target && $list[$cday][$i]['wr_link1']) {
$list[$cday][$i]['target'] = $is_link_target;
$list[$cday][$i]['href'] = $list[$cday][$i]['link_href'][1];
}
?>
<li>
<a href="<?php echo $list[$cday][$i]['href'];?>"<?php echo $list[$cday][$i]['target'];?><?php echo $is_modal_js;?>>
<span<?php echo ($list[$cday][$i]['wr_3']) ? ' class="'.$list[$cday][$i]['wr_3'].'"' : '';?>>
<?php echo apms_fa($list[$cday][$i]['as_icon']);?>
<?php echo $list[$cday][$i]['subject'] ;?>
</span>
<?php if($list[$cday][$i]['wr_comment']) { ?>
<span class="count orangered"><?php echo $list[$cday][$i]['wr_comment'];?></span>
<?php } ?>
</a>
</li>
<?php } ?>
</ul>
</div>
<?php } */?>
<?php if($do_cnt > 0) { ?>
<div class="media-body">
<ul class="do-list">
<li><?php echo $do_cnt; ?></li>
</ul>
</div>
<?php } ?>
</div>
<?php
$cday++;
} else {
echo '<div class=""></div>'.PHP_EOL;
}

if($iz%7 == 0) echo '</li>'.PHP_EOL;
}
?>
</ul>

답변을 작성하시기 전에 로그인 해주세요.
전체 139
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT