<?php
if ($member['mb_level'] >= $board['bo_read_level']) {
$today_w = date('Ymd', G5_SERVER_TIME); // 오늘일정
?>
<div class="day_list" style="width:<?php echo $width;?>">
<table>
<tr>
<th>오늘 일정<br><?php echo date('m월 d일', strtotime($today_w)); ?></th>
<td>
<?php
$sql = " select * from $write_table where wr_1 <= $today_w and wr_2 >= $today_w order by wr_num desc ";
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++) {
?>
<div>
<h3 class="day_subject"><?php echo get_text($row['wr_subject']); ?></h3>
<p class="day_content"><?php echo conv_content($row['wr_content'], 0) ?></p>
</div>
<?php } ?>
<?php if ($i == 0) { ?><p class="empty_day">오늘 일정이 없습니다.</p><?php } ?>
</td>
</tr>
</table>
</div>
<?php } ?>
달력게시판에서, 선택되어있는 달에 대한 전체일정을 보여주고 싶은데, 방법이있을까요?
현재 구현되어있는 건, 현재월 일 기준으로 오늘과 내일로만 표시되는데,
현재 보여지는 달에 대한 전체일정만 보여지게끔 하려고 합니다.
답변 1개 / 댓글 7개
$today_w1 = date('Ym01', G5_SERVER_TIME);
$today_w2 = date('Ymt', G5_SERVER_TIME);
$sql = " select * from $write_table where wr_1 <= $today_w2 and wr_2 >= $today_w1 order by wr_num desc ";
그런데 wr_1 와 wr_2 가 뭐죠??
날짜가 저장된 필드 한가지로 검색을 해야할텐데요??
아래 처럼..
wr_1 <= $today_w2 and wr_1 >= $today_w1
답변에 대한 댓글 7개
여기에서 $mm 부분을 선택한 월로 변경하세요
<div style="position:relative;width:<?php echo $width; ?>">
<div class="cal_title">
<a href="<?php echo $_SERVER['PHP_SELF']."?bo_table=".$bo_table."&"; ?><?php if ($month == 1) { $year_pre=$year-1; $month_pre=$month; } else {$year_pre=$year-1; $month_pre=$month;} echo ("year=$year_pre&month=$month_pre");?>" title="<?php echo $year_pre ?>년" class="cal_arrow"><i class="fa fa-angle-double-left" aria-hidden="true"></i></a>
<a href="<?php echo $_SERVER['PHP_SELF']."?bo_table=".$bo_table."&"; ?><?php if ($month == 1) { $year_pre=$year-1; $month_pre=12; } else {$year_pre=$year; $month_pre=$month-1;} echo ("year=$year_pre&month=$month_pre");?>" title="<?php echo $month_pre ?>월" class="cal_arrow"><i class="fa fa-angle-left" aria-hidden="true"></i></a>
<a href="<?php echo $_SERVER['PHP_SELF']."?bo_table=".$bo_table; ?>" title="오늘로" class="cal_today"><?php echo $year ?>년 <?php echo $month ?>월</a>
<a href="<?php echo $_SERVER['PHP_SELF']."?bo_table=".$bo_table."&"; ?><?php if ($month == 12) { $year_pre=$year+1; $month_pre=1; } else {$year_pre=$year; $month_pre=$month+1;} echo ("year=$year_pre&month=$month_pre");?>" title="<?php echo $month_pre ?>월" class="cal_arrow"><i class="fa fa-angle-right" aria-hidden="true"></i></a>
<a href="<?php echo $_SERVER['PHP_SELF']."?bo_table=".$bo_table."&"; ?><?php if ($month == 12) { $year_pre=$year+1; $month_pre=$month; } else {$year_pre=$year+1; $month_pre=$month;} echo ("year=$year_pre&month=$month_pre");?>" title="<?php echo $year_pre ?>년" class="cal_arrow"><i class="fa fa-angle-double-right" aria-hidden="true"></i></a>
</div>
<div style="position:absolute;top:0;right:0">
<?php if ($write_href) { ?>
<ul class="btn_bo_user">
<?php if ($admin_href) { ?><li><a href="<?php echo $admin_href ?>" class="btn_admin btn"><i class="fa fa-cog" aria-hidden="true"></i></a></li><?php } ?>
<?php if ($write_href) { ?><li><a href="<?php echo $write_href ?>" class="btn_b02 btn"><i class="fas fa-pencil-alt"></i> 일정추가</a></li><?php } ?>
</ul>
<?php } ?>
</div>
</div>
<div class="cal_tbl" style="width:<?php echo $width;?>">
<div class="cal_bgi">
<span class="cat_today_y_tit">
<?php echo $year ?>년
</span>
<span class="cat_today_d_tit">
<?php echo $month ?>월
</span>
<span class="cat_today_d_en">
<?php
if ($month == 1) {
echo "JANUARY";
} else if ($month == 2) {
echo "FEBRUARY";
} else if ($month == 3) {
echo "MARCH";
} else if ($month == 4) {
echo "APRIL";
} else if ($month == 5) {
echo "MAY";
} else if ($month == 6) {
echo "JUNE";
} else if ($month == 7) {
echo "JULY";
} else if ($month == 8) {
echo "AUGUST";
} else if ($month == 9) {
echo "SEPTEMBER";
} else if ($month == 10) {
echo "OCTOBER";
} else if ($month == 11) {
echo "NOVEMBER";
} else if ($month == 12) {
echo "DECEMBER";
}
?>
</span>
<span class="cat_bg_line"></span>
<?php
$today_w = date('Ymd', G5_SERVER_TIME); // 오늘일정
?>
<div class="day_list" style="width:<?php echo $width;?>">
<table style="width:<?php echo $width;?>">
<tr>
<?php
$month_arr = array(0=>$this_month);
foreach ($month_arr AS $key=>$mm) {
$sql = " select * from $write_table where wr_1 LIKE '{$mm}%' order by wr_num desc ";
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++) {
?>
<td class="day_d_tit" style="width: 100%; height: 50px; display: block; margin: 10px auto;">
<div>
<?php
echo "<a href='".G5_BBS_URL."/board.php?bo_table=$bo_table&year=$year&month=$month&wr_id=$row[wr_id]' id='subject_".$j."' ".$showLayer.">"?> <h3 class="day_subject"><?php echo get_text($row['wr_subject']); ?></h3> <?php "</a>" ?>
</div>
<?php } ?>
<?php } ?>
<?php if ($i == 0) { ?><p class="empty_day">오늘 일정이 없습니다.</p><?php } ?>
</td>
</tr>
</table>
</div>
</div>
<table>
<thead>
<tr>
<th style="color:red">일</th>
<th>월</th>
<th>화</th>
<th>수</th>
<th>목</th>
<th>금</th>
<th style="color:blue">토</th>
</tr>
</thead>
<tbody>
<?php
[/code]
답변을 작성하려면 로그인이 필요합니다.
<?php
$month_arr = array(0=>$this_month);
foreach ($month_arr AS $key=>$mm) {
$sql = " select * from $write_table where wr_1 LIKE '{$mm}%' order by wr_num desc ";
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++) {
?>
<div>
<h3 class="day_subject"><?php echo get_text($row['wr_subject']); ?></h3>
</div>
<?php } ?>
<?php } ?>
<?php if ($i == 0) { ?><p class="empty_day">오늘 일정이 없습니다.</p><?php } ?>
[/code]
이런식으로 변경을 한 상태인데, 적용이 되질 않네요ㅠㅠ 선택되어있는 월이 아닌, 지금 현재 월 기준으로만 나오고 있네요 ㅠ