길선아버님//2.XX버전 ==> 미니달력 3.0버전[수정] > 그누3 팁자료실

그누3 팁자료실

길선아버님//2.XX버전 ==> 미니달력 3.0버전[수정] 정보

PHP 길선아버님//2.XX버전 ==> 미니달력 3.0버전[수정]

본문

아래의 소스를 적용하면 미니 달력이 나옵니다....
날자를 클릭하면 글쓰는 폼으로 넘어가는데 자동으로 링크 2에 날짜가 입력이 되어져야 합니다.....
날짜 형식은 2003-09-15 형태로 입력이 되어져야만 하죠....그렇지 않으면 소스적용이 잘 안되고 있다는....
wr_link2 &nbsp;<---- 날짜가 입력이 되도록 했습니다....



[lib/debelorper.php]에 아래의 소스를 삽입합니다...

//*******************************************************************************/
// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 개발자(사용자) 라이브러리 작은달력 소스 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /
// &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /
//*******************************************************************************/

function gs_cal($input_y='',$input_m='',$bo_table='')
{
global $cfg, $gnu_path , $mb_id;

 &nbsp; &nbsp; // 주어진 날짜가 없으면 현재날짜 구하기
 &nbsp; &nbsp; &nbsp;if(!$input_y) $input_y = date('Y',time());
 &nbsp; &nbsp; &nbsp;if(!$input_m) $input_m = date('m',time());
 &nbsp; &nbsp; &nbsp;if(!$input_d) $input_d = date('d',time());

 &nbsp; &nbsp; &nbsp;$weekdate=date('w', mktime(0,0,0,$input_m,1,$input_y));

$currentday = "$input_y"."-"."$input_m" ;

for($i=28;$i<33;$i++)
 &nbsp; &nbsp; &nbsp;{
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $res = checkdate($input_m,$i,$input_y);
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(!$res)
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$tday = $i;
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$i = 33;
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }
 &nbsp; &nbsp; &nbsp;}
 &nbsp; &nbsp; &nbsp;$changerow =0;

 &nbsp; &nbsp; &nbsp;echo "<table border=0 cellspacing=1 cellpadding=0 width=100% bgcolor='#DDDDDD' style='font-size:12px; cursor:default'>";
 &nbsp; &nbsp; &nbsp;echo "<tr><td colspan=7 bgcolor='#FFFFFF' align=center height=30><b>$input_y 년 $input_m 월 $input_d 일</b> </th></tr>";
 &nbsp; &nbsp; &nbsp;echo "<tr bgcolor='#EEEEEE'>
<td bgcolor='#e2cbcb' height=25 align=center>일</td>
<td height=25 align=center>월</td>
<td height=25 align=center>화</td>
<td height=25 align=center>수</td>
<td height=25 align=center>목</td>
<td height=25 align=center>금</td>
<td bgcolor='#cbd5e2' height=25 align=center>토</td>
</tr>
<tr bgcolor='#FFFFFF'>
";

$today_schedule = "";//일정 목록

 &nbsp; &nbsp; &nbsp;for($i=1; $i < $tday + $weekdate; $i++)
 &nbsp; &nbsp; &nbsp;{
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $dispnum = $i - $weekdate;
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $changerow += 1;

 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; switch ($changerow % 7) {
case 1 :
$bgc = "bgcolor='#fcf5f5'";
break;
 case 0 :
$bgc = "bgcolor='#eff4f9'";
break;
default:
$bgc = "bgcolor='#FFFFFF'";
break;
}

//1~9까지의 숫자 앞에 0을 붙입니다.
if($dispnum < 10){$dispnums="0".$dispnum;}else{$dispnums=$dispnum;}
$a="{$currentday}"."-"."$dispnums";

$sql = "select * from $cfg[write_table_prefix]$bo_table where wr_link2='$a' order by wr_num desc";
$result= sql_query($sql);
$s_num = mysql_num_rows($result);//일정의 갯수
if($dispnum == $input_d) {
$bgc = "bgcolor='#C7E1E7'";
while($data = mysql_fetch_array($result)){
$wr_subject = cut_str($data[wr_subject],22);
$wr_content = cut_str($data[wr_content],250);
$mb_id = $data[mb_id];
$s_str .="<span style='font-size:9pt;'>* <a href='./?doc=bbs/gnuboard.php&bo_table=$bo_table&wr_id=$data[wr_id]&wr_link2='$a'' title='$wr_content'>$wr_subject</a></span><br>";
}

//오늘날짜에 있는 일정갯수 뽑기
if(strlen($s_str)>0){
$today_schedule = "<table width='100%' cellpadding=0 cellspacing=0><tr><td height=5></td></tr></table>
<table width=100% cellpadding=0 cellspacing=1><tr><td class='subject subjecttitlebg'>
<table width=100% cellpadding=0 cellspacing=1>
<tr><td class='subject subjectbg' align=center height=25>오늘의 일정</TD></TR> </table>
</td></tr></table>
<!-- 공백 -->
<table width='100%' cellpadding=0 cellspacing=0><tr><td height=5></td></tr></table>
<!--<marquee direction=up scrollamount=1 width=100% height=20>-->
<div align=left>
$s_str
</div>
<!--</marquee>-->
</a>
<!-- 공백 -->
<table width='100%' cellpadding=0 cellspacing=0><tr><td height=5></td></tr></table>

";
}
}

if ($s_num != 0) {
 $dlink ="<a href='./?doc=bbs/gbform.php&w=&bo_table=$bo_table&link2={$currentday}-$dispnums' title='{$s_num}개의 &nbsp;일정이 있습니다. 다시 일정을 등록하시려면 날짜를 클릭하세요.......[올라온 글]* {$wr_subject}'><b> ";
} else {
$dlink = "<a href='./?doc=bbs/gbform.php&w=&bo_table=$bo_table&link2={$currentday}-$dispnums' title='일정등록'>";
}

if($dispnums < 1) {
echo"<td $bgc> </td>";
} else {

echo "<td $bgc onMouseOver=this.style.backgroundColor='#FFCC66' onMouseOut=this.style.backgroundColor='' height=18 align=center>".$dlink."<font face=Tahoma size='1' color='#777777'>".$dispnums."</font></b></a></td>"; }

if(!($changerow % 7)&&($changerow < $tday + $weekdate))
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo "</tr><tr bgcolor='#FFFFFF'>";
 &nbsp; &nbsp; &nbsp;}
 &nbsp; &nbsp; &nbsp;$td_tail = &nbsp;7 - ($changerow % 7);

 &nbsp; &nbsp; &nbsp;if($td_tail != 7)
 &nbsp; &nbsp; &nbsp;{
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for($i = 1; $i <= $td_tail; $i++) echo "<td> </td>";
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo "</tr></table>";
 &nbsp; &nbsp; &nbsp;}
echo($today_schedule);
}

불러내고 싶은 자리에 아래의 소스를 붙이면 됩니다.
<?php gs_cal('','','calendar')?>
이렇게 하시면 됩니다....

그리고 위의 소스는 wr_link2에 날자가 입력됩니다.......입력되는 날자형식은 2003-08-30형태로 입력이됩니다.....


혹시 날자를 클릭했을때 gbform.php으로 날짜 값이 링크 2에 넘어가지 않을때 달력 스킨의 gbform.skin.php에서
이렇게 고쳐주시길 바랍니다....
//************** &nbsp; 수정 전 **********************
<? if ($is_link) { ?>
 &nbsp; &nbsp;<? for ($i=1; $i<=$cfg[link_count]; $i++) { ?>
 &nbsp; &nbsp;<tr class='ht'><td>링크 #<?=$i?>&nbsp;:&nbsp;</td><td><input type=text name='wr_link<?=$i?>' itemname='링크 #<?=$i?>' value='<?=$link[$i]?>' class='input' size=60></td></tr>
 &nbsp; &nbsp;<? } ?>
<? } ?>

//*********** &nbsp; 수정 후 *****************************
<? if ($is_link) { ?>
 &nbsp; &nbsp;<tr class='ht'><td>링크 #1&nbsp;:&nbsp;</td><td><input type=text name='wr_link1' itemname='링크 #1' value='<?=$link1?>' class='input' size=60></td></tr>
 &nbsp; &nbsp;<tr class='ht'><td>링크 #2&nbsp;:&nbsp;</td><td><input type=text name='wr_link2' itemname='링크 #2' value='<?=$link2?>' class='input' size=60></td></tr>
<? } ?>

잘 사용하시길 바랍니다.....

그리고 길선 아버님께 감사드립니다.......*^^*
추천
1
  • 복사

댓글 전체

스킨의 종료에 따라 좀 수정해야 할부분이 있는데염...
스킨에서 사용하는 입력방법이 2003-01-01 와 같을땐

$currentday = "$input_y"."-"."$input_m" ;
.
.
$a="{$currentday}"."-"."$dispnums";

이렇지만

20030101 이런 방법으로 입력이 될땐

$currentday = "$input_y".""."$input_m" ;
.
.
$a="{$currentday}".""."$dispnums";

이렇게 바꿔줘야 오늘의 일정이 표출이 되네염....
에궁 나이들어 머린 안돌구 눈알 빠지게 쳐다봐야 조금 알거 같네염.....쯔~
버그가 있는것 같군요??

로그인 문제네요......  창 체크 안하고 닫고 ... 로그인한다음......새로고침해버리니 로그인아웃되네요?
어떨때는... 로그인상태고 어떨때는 로그아웃해버리네요? 새로고침할때.....경우임...

쿠키 충돌??
© SIRSOFT
현재 페이지 제일 처음으로