제발 달력 좀 도와주세요.......... > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

제발 달력 좀 도와주세요.......... 정보

제발 달력 좀 도와주세요..........

본문

참고로 위에 22일에 파란색으로 다르게 보이는데
그 부분은 일정게시물을 등록했을 경우 저렇게 보이는거구요
오늘 24일인데 다른 날짜랑 똑같은 하얀색으로만 보여집니다.....


http://www.sir.co.kr/bbs/tb.php/g4_skin/52677/37e07c28421952f146f67d91d65ea46f


현재 lastest.skin.php 가 이런 내용이구요
이안에 분명 스타일에

td.today    {
text-align: center; padding-top: 2pt; height:<?=$cellh?>; width:<?=$cellh?>;
background-image: url(<?=$latest_skin_path?>/img/mini3.gif);

mini3.gif라는 파일로 오늘 날짜가 좀 확인되도록 보여지는것 같은데...
도대체가 보이지도 않고
알수가 없습니다

참고 스크린샷 좀 참고해서
제발 제발 제발 좀 알려주세요
며칠째 헤메이는데..... 도움 좀.............




<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

$cellh  = 21;
$cellw  = 21;
?>

<style type="text/css">
td.title    {text-align: center; padding-top: 1pt; padding-bottom: 1pt; height: 25px; font-weight:bold;}
td.invalid  {
text-align: center; padding-top: 2pt; height:<?=$cellh?>; width:<?=$cellh?>;
background-image: url(<?=$latest_skin_path?>/img/mini2.gif);
}

td.valid    {
text-align: center; padding-top: 2pt; height:<?=$cellh?>; width:<?=$cellh?>;
background-image: url(<?=$latest_skin_path?>/img/mini2.gif);
}

td.today    {
text-align: center; padding-top: 2pt; height:<?=$cellh?>; width:<?=$cellh?>;
background-image: url(<?=$latest_skin_path?>/img/mini3.gif);
}
.bgsun    {text-align: center; font-size: 8pt; color: #ff00ff; padding-top: 2pt; height:<?=$cellh?>; width:<?=$cellh?>;
background-image: url(<?=$latest_skin_path?>/img/mini2.gif);
}
.bgsat  {text-align: center; font-size: 8pt; color: #3366cc; padding-top: 2pt; height:<?=$cellh?>; width:<?=$cellh?>;
background-image: url(<?=$latest_skin_path?>/img/mini2.gif);
}
.bgweek  {text-align: center; font-size: 8pt; padding-top: 2pt; height:<?=$cellh?>; width:<?=$cellh?>;
background-image: url(<?=$latest_skin_path?>/img/mini2.gif);
}

p.title    {font-size: 1em; font-weight:bold}
p.sunday    {text-align: center; font-size: 8pt; color: #ff00ff;}
p.saturday  {text-align: center; font-size: 8pt; color: #3366cc;}
p.weekday  {text-align: center; font-size: 8pt;}

a:link.writeday, a:visited.writeday  {text-align: center; font-size: 8pt; color: #fd7100; font-weight:bold;}
 img {border:0}
 </style>

<?

$today = getdate();
$b_mon = $today['mon'];
$b_day = $today['mday'];
$b_year = $today['year'];
if ($year < 1) {
  $month = $b_mon;
  $mday = $b_day;
  $year = $b_year;
}

$lastday=array(0,31,28,31,30,31,30,31,31,30,31,30,31);
if ($year%4 == 0) $lastday[2] = 29;
$dayoftheweek = date("w", mktime (0,0,0,$month,1,$year));

?>
<table width="100%" border="0" cellspacing="1" cellpadding="0" bgcolor="#DDDDDD">
  <tr bgcolor="#FFFFFF">
    <td>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr height="30">
          <td width="40" align="right"><a href="<?="$_SERVER[PHP_SELF]?&"?><?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&bo_table=$bo_table");?>" target="_self"onfocus="this.blur()" title="<?=$month_pre?> 월"><img src="<?=$latest_skin_path?>/img/month_prev.gif" align=absmiddle border=0></a></td>
          <td width="90" align="center"><a href="<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>" onfocus="this.blur()" title="일정관리 바로가기"><?=$year?></a> 년 <a href="<?="$_SERVER[PHP_SELF]?&bo_table=$bo_table"?>" onfocus="this.blur()" title="이번 달"><?=$month?></a> 월</td>
          <td width="40" align="left"><a href="<?="$_SERVER[PHP_SELF]?&"?><?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&bo_table=$bo_table");?>" target="_self"onfocus="this.blur()" title="<?=$month_pre?> 월"><img src="<?=$latest_skin_path?>/img/month_next.gif" align=absmiddle border=0></a></td>
        </tr>
      </table>
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="100%">  
<TABLE width=<?=$cellw*7?> cellSpacing=0 cellPadding=0 border=0 align=center>
<TR>
<td class=bgsun><p class=sunday>일</p></td>
<td class=bgweek><p class=weekday>월</p></td>
<td class=bgweek><p class=weekday>화</p></td>
<td class=bgweek><p class=weekday>수</p></td>
<td class=bgweek><p class=weekday>목</p></td>
<td class=bgweek><p class=weekday>금</p></td>
<td class=bgsat><p class=saturday>토</p></td>
</TR>
<TR>
<?
$cday = 1;
$sel_mon = sprintf("%02d",$month);
$query = "SELECT * FROM $write_table WHERE left(wr_link1,6) <= '$year$sel_mon'  and left(wr_link2,6) >= '$year$sel_mon'  ORDER BY wr_id ASC";
$result = sql_query($query);

// 내용을 보여주는 부분
while ($row = mysql_fetch_array($result)) {  // 제목글 뽑아서 링크 문자열 만들기..
 if( substr($row[wr_link1],0,6) <  $year.$sel_mon ) {
$start_day =1;
$start_day= (int)$start_day;
 } else {
$start_day = substr($row[wr_link1],6,2);
    $start_day= (int)$start_day;
 }

 if( substr($row[wr_link2],0,6) >  $year.$sel_mon ) {
$end_day = $lastday[$month];
$end_day= (int)$end_day;
 } else {
$end_day = substr($row[wr_link2],6,2);
$end_day= (int)$end_day;
 }

  for ($i = $start_day ; $i <= $end_day;  $i++) {
// $html_day[$i].= 은  문자를 덧붙이는 작업이다. 바로 . (쩜) 의 위력이다.
$html_day[$i] = "1"; //"<p><a href='javascript:;' onclick=\"popup_schedule('./pop_schedule.php?bo_table=$bo_table&year=$year&month=$month&day=$i');\" class=writeday>"; //.</a>"."\n";
// $html_day[$i].= "<p><a href='javascript:;' onclick=\"popup_schedule('./popup_schedule.php?bo_table=$bo_table&wr_id=$row[wr_id]');\" class=writeday>"; //.</a>"."\n";
//$html_day[$i].= "<br><a href='?doc=bbs/gnuboard.php&bo_table=$bo_table&wr_id=$row[wr_id]'>".substr($row[wr_subject],0,18)."</a>"."\n";
// substr로 끊으면 경우에 따라 지져분해 지므로..
  }
 }

// 달력의 틀을 보여주는 부분
// 여기부터 분석하면 됨

$temp = 7- (($lastday[$month]+$dayoftheweek)%7);
// $dayoftheweek; // 6 이다.
// $temp = 6 이다. 무슨 의미인가?

if ($temp == 7) $temp = 0;
    $lastcount = $lastday[$month]+$dayoftheweek + $temp;

// $lastcount = 42
// $lastcount 는 달력을 이루고 있는 전체 셀의 갯수이다.  2003년 11월은 날짜 30개와 빈칸 12개 다.
//
for ($iz = 1; $iz <= $lastcount; $iz++) { // 42번을 칠하게 된다.
$bgcolor = "#ffffff";  // 쭉 흰색으로 칠하고
$offset = $iz%7;
if ($offset == 1) echo ("  <tr>\n"); // 주당 7개씩 한쎌씩을 쌓는다.
if ($dayoftheweek < $iz  &&  $iz <= $lastday[$month]+$dayoftheweek) {

  if ($b_year==$year && $b_mon==$month && $b_day==$cday) {
$cstyle = 'today';
  } else {
$cstyle = 'valid';
  }

  switch ($offset) {            // 요일에 따라 날짜의 색깔 결정
case 1: $dstyle = 'sunday';
break;
case 0: $dstyle = 'saturday';
break;
default: $dstyle = 'weekday';
  }
// 전체 루프안에서 숫자가 들어가는 셀들만 해당됨
// 즉 11월 달에서 1일부터 30 일까지만 해당
  $daytext = "$cday";  // $cday 는 숫자 예> 11월달은 1~ 30일 까지
  //$daytext 은 셀에 써질 날짜 숫자 넣을 공간
//   if ($iz%7 == 1) $daytext = "<font color=red>$daytext</font>"; // 일요일
//   if ($iz%7 == 0) $daytext = "<font color=blue>$daytext</font>"; // 토요일
 
      // 여기까지 숫자와 들어갈 내용에 대한 변수들의 세팅이 끝나고
      // 이제 여기 부터 직접 셀이 그려지면서 그 안에 내용이 들어 간다.

  echo ("    <td class=$cstyle>\n");
  if ($html_day[$cday]) {
$f_date = $year.sprintf("%02d",$month).sprintf("%02d",$cday);

        echo "<p><a href=\"javascript:win_open('$g4[path]/pop_schedule.php?bo_table=$bo_table&year=$year&month=$month&day=$cday', 'schedule', 'left=50, top=50, width=300, height=400, scrollbars=1');\" class=writeday><b>$daytext</b></a></p>\n";
  }
  else { // 글쓰기 권한이 없으면 글쓰기 링크는 넣지 않고 그냥 숫자만 출력하기
        echo "<p class=$dstyle>$daytext</p>\n";
      }
//   echo $html_day[$cday];
  echo ("    </td>\n");  // 한칸을 마무리
  $cday++; // 날짜를 카운팅
}
// 11월에서 1일부터 30일에 해당되지 않으면 그냥 회색을 칠한다.
else { echo ("    <td class=invalid>&nbsp;</td>\n"); }
  if (($iz%7) == 0) echo ("  </tr>\n");

} // 반복구문이 끝남
?>
</table>  
  </td>
        </tr>
      </table><br>
      </td>
  </tr>
</table>

댓글 전체

원래 오늘일자표시는 안되는것 같은데요?
http://www.poriter.com/

1~31까지 번호 출력하는 곳에 조건절을 걸어주셔야 겠네요.
만약에 1~31까지 일수를 for 문으로 돌린다면.
for ($i=0; $i<32 $i++) {
  if ($i == date(d)) {
    echo "<font color=red>$i</font>";
  } else {
    echo $i;
  }
}

이런식이겠죠. date(d)가 오늘일수를 표시하는 것이니.
와! 그런거였군요!!!!
그럼

for ($i=0; $i<32 $i++) {
  if ($i == date(d)) {
    echo "<font color=red>$i</font>";
  } else {
    echo $i;
  }
}


이 for문을 특별한 라인에 넣어야 할 곳이 있나요?
아니면 아무데나 넣어도 되나요?
그건 예제 인데요. ㅡ_
저 달력소스에서 숫자를 출력하는 부분을 찾아서 거기에 맞게 넣어주셔야죠.

제가 김을 드렸으니 밥을 넣고 말으시면 김밥이 되는거빈다. ㄳ
td.today 스타일을 오늘 날짜에 적용하고 싶다는거죠?
이렇게 하세요
 if( $cstyle == 'today' ) $tdstyle = 'class=today';
else $tdstyle = '';
1. 위 스크립트를 switch ($offset) {            // 요일에 따라 날짜의 색깔 결정
닫는 괄호 } 다음에 넣으세요

2. 바로 그 아래 부분을 이렇게 수정 하세요
  echo ("    <td align='center' height='15' $tdstyle>\n");
---------------------------------------------------------------------------------
td.today { padding-top: 1pt; background-image: url(<?=$latest_skin_path?>/img/mini3.gif); font-weight:bold;}
<-- 요것도 수정

백그라운드 이미지 사이즈를 변경 해야 할 겁니다
<td align='center' width=21 height=21 로 수정하고 min3.gif 가로 사이즈를 조절하면 되겠어요
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

$cellh  = 21;
$cellw  = 21;
?>
<style type="text/css">
td.title    {text-align: center; padding-top: 1pt; padding-bottom: 1pt; height: 25px; font-weight:bold;}
td.invalid  {
text-align: center; padding-top: 2pt; height:<?=$cellh?>; width:<?=$cellh?>;
background-image: url(<?=$latest_skin_path?>/img/mini2.gif);
}
td.valid    {
text-align: center; padding-top: 2pt; height:<?=$cellh?>; width:<?=$cellh?>;
background-image: url(<?=$latest_skin_path?>/img/mini2.gif);
}
td.today {
    padding-top: 1pt; background-image: url(<?=$latest_skin_path?>/img/mini3.gif); font-weight:bold;
    td align='center' width=21 height=21;
}

.bgsun    {text-align: center; font-size: 8pt; color: #ff00ff; padding-top: 2pt; height:<?=$cellh?>; width:<?=$cellh?>;
background-image: url(<?=$latest_skin_path?>/img/mini2.gif);
}
.bgsat  {text-align: center; font-size: 8pt; color: #3366cc; padding-top: 2pt; height:<?=$cellh?>; width:<?=$cellh?>;
background-image: url(<?=$latest_skin_path?>/img/mini2.gif);
}
.bgweek  {text-align: center; font-size: 8pt; padding-top: 2pt; height:<?=$cellh?>; width:<?=$cellh?>;
background-image: url(<?=$latest_skin_path?>/img/mini2.gif);
}

p.title    {font-size: 1em; font-weight:bold}
p.sunday    {text-align: center; font-size: 8pt; color: #ff00ff;}
p.saturday  {text-align: center; font-size: 8pt; color: #3366cc;}
p.weekday  {text-align: center; font-size: 8pt;}

a:link.writeday, a:visited.writeday  {text-align: center; font-size: 8pt; color: #0069D2; font-weight:bold;}
 img {border:0}
 </style>
<?
$today = getdate();
$b_mon = $today['mon'];
$b_day = $today['mday'];
$b_year = $today['year'];
if ($year < 1) {
  $month = $b_mon;
  $mday = $b_day;
  $year = $b_year;
}
$lastday=array(0,31,28,31,30,31,30,31,31,30,31,30,31);
if ($year%4 == 0) $lastday[2] = 29;
$dayoftheweek = date("w", mktime (0,0,0,$month,1,$year));
?>
<table width="200" cellpadding=0 cellspacing=0>
<tr>
    <td colspan=3 align=center><a href="<?=$g4[path]?>/bbs/board.php?bo_table=01_5" onfocus=this.blur()><img src="<?=$latest_skin_path?>/img/meeting_title.png" border="0"></a></td>
</tr>
<tr>
    <td align=center width="5" height="120" background="<?=$latest_skin_path?>/img/meeting_left_bg.png"></td>
    <td align=center width="190" valign="top">
<!-- 반복구문 시작 -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr height="20">
    <td width="45" align="right"><a href="<?="$_SERVER[PHP_SELF]?&"?><?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&bo_table=$bo_table");?>" target="_self"onfocus="this.blur()" title="<?=$month_pre?> 월"><img src="<?=$latest_skin_path?>/img/month_prev.gif" align=absmiddle border=0></a></td>
    <td width="100" align="center"><b><font style='font-family:돋움; font-size:9pt; color:#FB6900;'><?=$year?></a> 년 <?=$month?></a> 월</font></b></td>
    <td width="45" align="left"><a href="<?="$_SERVER[PHP_SELF]?&"?><?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&bo_table=$bo_table");?>" target="_self"onfocus="this.blur()" title="<?=$month_pre?> 월"><img src="<?=$latest_skin_path?>/img/month_next.gif" align=absmiddle border=0></a></td>
  </tr>
  <tr><td colspan="3" height='1' align="center"><table width=170 height="1" cellSpacing=0 cellPadding=0 border=0 align="center"><tr><td height="1" bgcolor="#FFAC59"></td></tr></table></td></tr>
</table>
<TABLE width=180 cellSpacing=0 cellPadding=0 border=0 align=center>
<TR>
<td align="center" height="15"><img src="<?=$latest_skin_path?>/img/sun.jpg"></td>
<td align="center"><img src="<?=$latest_skin_path?>/img/mon.jpg"></td>
<td align="center"><img src="<?=$latest_skin_path?>/img/thu.jpg"></td>
<td align="center"><img src="<?=$latest_skin_path?>/img/wed.jpg"></td>
<td align="center"><img src="<?=$latest_skin_path?>/img/thu.jpg"></td>
<td align="center"><img src="<?=$latest_skin_path?>/img/fri.jpg"></td>
<td align="center"><img src="<?=$latest_skin_path?>/img/sat.jpg"></td>
</TR>
<tr><td colspan="7" height='1' align="center"><table width=170 height="1" cellSpacing=0 cellPadding=0 border=0 align="center"><tr><td height="1" bgcolor="#FFAC59"></td></tr></table></td></tr>
<TR>
<?
$cday = 1;
$sel_mon = sprintf("%02d",$month);
$query = "SELECT * FROM $write_table WHERE left(wr_link1,6) <= '$year$sel_mon'  and left(wr_link2,6) >= '$year$sel_mon'  ORDER BY wr_id ASC";
$result = sql_query($query);

// 내용을 보여주는 부분
while ($row = mysql_fetch_array($result)) {  // 제목글 뽑아서 링크 문자열 만들기..
if( substr($row[wr_link1],0,6) <  $year.$sel_mon ) {
$start_day =1;
$start_day= (int)$start_day;
} else {
$start_day = substr($row[wr_link1],6,2);
    $start_day= (int)$start_day;
}

if( substr($row[wr_link2],0,6) >  $year.$sel_mon ) {
$end_day = $lastday[$month];
$end_day= (int)$end_day;
} else {
$end_day = substr($row[wr_link2],6,2);
$end_day= (int)$end_day;
}

  for ($i = $start_day ; $i <= $end_day;  $i++) {
$html_day[$i] = "1"; //"<p><a href='javascript:;' onclick=\"popup_schedule('./pop_schedule.php?bo_table=$bo_table&year=$year&month=$month&day=$i');\" class=writeday>"; //.</a>"."\n";
// $html_day[$i].= "<p><a href='javascript:;' onclick=\"popup_schedule('./popup_schedule.php?bo_table=$bo_table&wr_id=$row[wr_id]');\" class=writeday>"; //.</a>"."\n";
//$html_day[$i].= "<br><a href='?doc=bbs/gnuboard.php&bo_table=$bo_table&wr_id=$row[wr_id]'>".substr($row[wr_subject],0,18)."</a>"."\n";
// substr로 끊으면 경우에 따라 지져분해 지므로..
$wr_id[$i]=$row[wr_id]; //팝업시 코멘트를 쓰기 위해 wr_id를 가져가려고 추가됨
  }
 }
// 달력의 틀을 보여주는 부분
// 여기부터 분석하면 됨
$temp = 7- (($lastday[$month]+$dayoftheweek)%7);
// $dayoftheweek; // 6 이다.
// $temp = 6 이다. 무슨 의미인가?

if ($temp == 7) $temp = 0;
    $lastcount = $lastday[$month]+$dayoftheweek + $temp;

// $lastcount = 42
// $lastcount 는 달력을 이루고 있는 전체 셀의 갯수이다.  2003년 11월은 날짜 30개와 빈칸 12개 다.
//
for ($iz = 1; $iz <= $lastcount; $iz++) { // 42번을 칠하게 된다.
$bgcolor = "#ffffff";  // 쭉 흰색으로 칠하고
$offset = $iz%7;
if ($offset == 1) echo ("  <tr>\n"); // 주당 7개씩 한쎌씩을 쌓는다.
if ($dayoftheweek < $iz  &&  $iz <= $lastday[$month]+$dayoftheweek) {
  if ($b_year==$year && $b_mon==$month && $b_day==$cday) {
$cstyle = 'today';
  } else {
$cstyle = 'valid';
  }

  switch ($offset) {            // 요일에 따라 날짜의 색깔 결정
    if( $cstyle == 'today' ) $tdstyle = 'class=today';
else $tdstyle = '';
case 1: $dstyle = 'sunday';
break;
case 0: $dstyle = 'saturday';
break;
default: $dstyle = 'weekday';
  }
// 전체 루프안에서 숫자가 들어가는 셀들만 해당됨
// 즉 11월 달에서 1일부터 30 일까지만 해당
  $daytext = "$cday";  // $cday 는 숫자 예> 11월달은 1~ 30일 까지
  //$daytext 은 셀에 써질 날짜 숫자 넣을 공간
//   if ($iz%7 == 1) $daytext = "<font color=red>$daytext</font>"; // 일요일
//   if ($iz%7 == 0) $daytext = "<font color=blue>$daytext</font>"; // 토요일
 
      // 여기까지 숫자와 들어갈 내용에 대한 변수들의 세팅이 끝나고
      // 이제 여기 부터 직접 셀이 그려지면서 그 안에 내용이 들어 간다.

  echo ("    <td align='center' height='15' $tdstyle>\n");
  if ($html_day[$cday]) {
$f_date = $year.sprintf("%02d",$month).sprintf("%02d",$cday);
        echo "<p><a href=\"javascript:win_open('$g4[path]/bbs/pop_schedule.php?bo_table=$bo_table&wr_id=$wr_id[$cday]&year=$year&month=$month&day=$cday', 'schedule', 'left=0, top=0, width=690, height=530, scrollbars=1');\" class=writeday><b>$daytext</b></a></p>\n";
  }
  else { // 글쓰기 권한이 없으면 글쓰기 링크는 넣지 않고 그냥 숫자만 출력하기
        echo "<p class=$dstyle>$daytext</p>\n";
      }
//   echo $html_day[$cday];
  echo ("    </td>\n");  // 한칸을 마무리
  $cday++; // 날짜를 카운팅
}
// 11월에서 1일부터 30일에 해당되지 않으면 그냥 회색을 칠한다.
else { echo ("    <td>&nbsp;</td>\n"); }
  if (($iz%7) == 0) echo ("  </tr>\n");

} // 반복구문이 끝남
?>
</table>  
<!-- 반복구문 끝 -->
</td>
    <td align=center width="5" background="<?=$latest_skin_path?>/img/meeting_right_bg.png"></td>
</tr>
<tr>
    <td colspan=3 align=center><img src="<?=$latest_skin_path?>/img/meeting_bottom.png"></td>
</tr>
</table>



17~19 라인
137~139 라인
156 라인
위에 latest.skin 에서 말씀하신대로 바꿔주었는데
오류가 나고 안됩니다

제가 잘 못한건지.......
전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

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