주간소스에서 일정없는날을 안나오게하는 법 채택완료
http://jjcy.or.kr/">http://jjcy.or.kr/
보면 우측상단에 이주의 일정에서
일정없는날은 - 로 표시가 되는데요~~
일정없는날은 아예 안나오게 하려면
아래 소스에서 어디를 수정해야할런지요~?
<?
$yoil = array ("월", "화", "수", "목", "금");
$today = mktime (0,0,0,date("n") , date("j")+2, date("Y"));
$w=date('w');//요일
if($w==0)$w=7;//일요일을 0에서 7로 변경
$week=$w-1;//한칸 당김, 0월 1화 2수 3목 4금 5토 6일
$monday = $today-$w*3600*24; //월요일</strong></p><p><strong>for ($i=0; $i<=6; $i++){
$days_org[$i] = $monday+3600*24*$i;
$days[$i] = gmdate('Y',$days_org[$i]).gmdate('m',$days_org[$i]).gmdate('d',$days_org[$i]);
$query = "select * from $write_table where wr_link1 = '$days[$i]' order by wr_id asc";
$rst = sql_query($query);
$data = sql_fetch_array($rst);
$memo[$i]=$data['wr_subject'];
if(!$memo[$i]) $memo[$i] = "-";
$day[$i] = gmdate('n',$days_org[$i])."/".gmdate('j',$days_org[$i])."";
$cday[$i] = gmdate('j',$days_org[$i]);
$cyear[$i] = gmdate('Y',$days_org[$i]);
$cmonth[$i] = gmdate('n',$days_org[$i]);
}
?></strong></p><p><strong>
</strong></p><p><strong>
<TABLE cellSpacing=0 cellPadding=0 width='270' align=right border=0>
<tr>
<td></strong></p><p><strong> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr> </strong></p><p><strong> <td bgcolor="#CCCCCC">
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td height="106" bgcolor="#FFFFFF" align=right border=0></strong></p><p><strong> <table border=0 cellpadding=0 cellspacing=0 width=270 bgcolor=white bordercolor=white bordercolorlight=#edede9>
<tr>
<? for ($i = 0; $i<=4; $i++) {
echo "<tr><td align='left' valign='middle' height='15' width='10' bgcolor='#ffffff'> </td><td align='left' valign='middle' height='15' width='70' bgcolor='#ffffff'> $yoil[$i]($day[$i])</td><td align='left' valign='middle' height=23' width='200' bgcolor='#ffffff' class='cal_title'><a href='$g4[path]/bbs/board.php?bo_table=plan&mode=w'> <font style='font-family:돋움; font-size:10pt; color:#666666;'>".$memo[$i]."</font></a></tr> \n";
}
echo "<tr><td align='left' valign='middle' height='15' width='10' bgcolor='#d4fefe'> </td><td align='left' valign='middle' height=15' width='70' bgcolor='#d4fefe'> <font color='#2C88B9' > 토($day[5])</font></td><td align='left' valign='middle' height='23' width='200' bgcolor='#d4fefe' class='cal_title'><a href='$g4[path]/bbs/board.php?bo_table=plan&mode=w'> <font style='font-family:돋움; font-size:10pt; color:#666666;'>".$memo[$i]."</font></a></tr> \n";
echo "<tr><td align='left' valign='middle' height='15' width='10' bgcolor='#fde2e7'> </td><td align='left' valign='middle' height='15' width='70' bgcolor='#fde2e7'><font color='#ff0000' > 일($day[6])</font></td><td align='left' valign='middle' height='23' width='200' bgcolor='#fde2e7' class='cal_title'><a href='$g4[path]/bbs/board.php?bo_table=plan&mode=w'> <font style='font-family:돋움; font-size:10pt; color:#666666;'>".$memo[$i]."</font></a></tr> \n";
?>
</tr>
</table>
</td>
</tr>
</table></td>
</tr>
</table></strong></p><p><strong>
</td>
</tr>
</table></strong></p><p><strong>
</strong></p><p><strong>
답변 3개
일정이 없는날은 검색을 안하면되죠~
select * from $write_table where wr_link1 = '$days[$i]' and wr_subject is not null order by wr_id asc
+++++ 추가 +++++
요일도 수정해야겠네여...
다고치기 귀찮으시니깐 위에 파란색으로 쿼리문 무시하시고 아래 for문만 수정 ㄱㄱ
</p><p><span style="line-height: normal; font-size: 10pt;">for ($i = 0; $i<=4; $i++) {</span></p><p><span style="line-height: normal; font-size: 10pt;"> </span></p><p><span style="line-height: normal;">if(</span><span style="line-height: normal; font-size: 10pt;">$memo[$i] != '-'</span><span style="line-height: normal; font-size: 10pt;">){ // wr_subject가 없으면 -로 대체하니깐 제목이 -인 것들은 echo안하고 넘기고 다음꺼검사</span></p><pre style="line-height: normal;"> echo "<tr><td align='left' valign='middle' height='15' width='10' bgcolor='#ffffff'> </td><td align='left' valign='middle' height='15' width='70' bgcolor='#ffffff'> $yoil[$i]($day[$i])</td><td align='left' valign='middle' height=23' width='200' bgcolor='#ffffff' class='cal_title'><a href='$g4[path]/bbs/board.php?bo_table=plan&mode=w'> <font style='font-family:돋움; font-size:10pt; color:#666666;'>".$memo[$i]."</font></a></tr> \n"; </pre><pre style="line-height: normal;">}</pre><p><span style="line-height: normal; font-size: 10pt;"> }</span> </p><p><span style="line-height: normal; font-size: 10pt;">
댓글을 작성하려면 로그인이 필요합니다.
제가 잘못 적용한건가요?~
다른데 넣어봐도 계속 에러페이지가 뜹니당
</strong></p><p><?
$yoil = array ("월", "화", "수", "목", "금");
$today = mktime (0,0,0,date("n") , date("j")+2, date("Y"));
$w=date('w');//요일
if($w==0)$w=7;//일요일을 0에서 7로 변경
$week=$w-1;//한칸 당김, 0월 1화 2수 3목 4금 5토 6일
$monday = $today-$w*3600*24; //월요일</p><p>for ($i=0; $i<=6; $i++){
$days_org[$i] = $monday+3600*24*$i;
$days[$i] = gmdate('Y',$days_org[$i]).gmdate('m',$days_org[$i]).gmdate('d',$days_org[$i]);
$query = "select * from $write_table where wr_link1 = '$days[$i]' and wr_subject is not null order by wr_id asc?";
$rst = sql_query($query);
$data = sql_fetch_array($rst);
$memo[$i]=$data['wr_subject'];
if(!$memo[$i]) $memo[$i] = "-";
$day[$i] = gmdate('n',$days_org[$i])."/".gmdate('j',$days_org[$i])."";
$cday[$i] = gmdate('j',$days_org[$i]);
$cyear[$i] = gmdate('Y',$days_org[$i]);
$cmonth[$i] = gmdate('n',$days_org[$i]);
}
?></p><p> </p><p>
<TABLE cellSpacing=0 cellPadding=0 width='270' align=right border=0>
<tr>
<td></p><p> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr> </p><p> <td bgcolor="#CCCCCC">
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td height="106" bgcolor="#FFFFFF" align=right border=0></p><p> <table border=0 cellpadding=0 cellspacing=0 width=270 bgcolor=white bordercolor=white bordercolorlight=#edede9>
<tr>
<? for ($i = 0; $i<=4; $i++) {
if($memo[$i] != '-'?){ // wr_subject가 없으면 -로 대체하니깐 제목이 -인 것들은 echo안하고 넘기고 다음꺼검사
echo "<tr><td align='left' valign='middle' height='15' width='10' bgcolor='#ffffff'> </td><td align='left' valign='middle' height='15' width='70' bgcolor='#ffffff'> $yoil[$i]($day[$i])</td><td align='left' valign='middle' height=23' width='200' bgcolor='#ffffff' class='cal_title'><a href='$g4[path]/bbs/board.php?bo_table=plan&mode=w'> <font style='font-family:돋움; font-size:10pt; color:#666666;'>".$memo[$i]."</font></a></tr> \n";
}
echo "<tr><td align='left' valign='middle' height='15' width='10' bgcolor='#d4fefe'> </td><td align='left' valign='middle' height=15' width='70' bgcolor='#d4fefe'> <font color='#2C88B9' > 토($day[5])</font></td><td align='left' valign='middle' height='23' width='200' bgcolor='#d4fefe' class='cal_title'><a href='$g4[path]/bbs/board.php?bo_table=plan&mode=w'> <font style='font-family:돋움; font-size:10pt; color:#666666;'>".$memo[$i]."</font></a></tr> \n";
echo "<tr><td align='left' valign='middle' height='15' width='10' bgcolor='#fde2e7'> </td><td align='left' valign='middle' height='15' width='70' bgcolor='#fde2e7'><font color='#ff0000' > 일($day[6])</font></td><td align='left' valign='middle' height='23' width='200' bgcolor='#fde2e7' class='cal_title'><a href='$g4[path]/bbs/board.php?bo_table=plan&mode=w'> <font style='font-family:돋움; font-size:10pt; color:#666666;'>".$memo[$i]."</font></a></tr> \n";
?>
</tr>
</table>
</td>
</tr>
</table></td>
</tr>
</table></p><p>
</td>
</tr>
</table></p><p> <strong>
댓글을 작성하려면 로그인이 필요합니다.
15번줄 코드
<font face="Courier New">if<code class="php plain">(!</code></font><code class="php variable">$memo</code><code class="php plain">[</code><code class="php variable">$i</code><code class="php plain">]) </code><code class="php variable">$memo</code><code class="php plain">[</code><code class="php variable">$i</code><code class="php plain">] = </code><code class="php string">"-"</code><code class="php plain">;</code>
인 코드를
//<font face="Courier New">if<code class="php plain">(!</code></font><code class="php variable">$memo</code><code class="php plain">[</code><code class="php variable">$i</code><code class="php plain">]) </code><code class="php variable">$memo</code><code class="php plain">[</code><code class="php variable">$i</code><code class="php plain">] = </code><code class="php string">"-"</code><code class="php plain">;</code>
주석 처리는 해보셧나요 ?
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
ㅜㅜ 위부분 시도해봤었는데요~
월(1/5) 는 나오고 내용나오는곳은 걍 빈곳으로만 나와서 포기했어욤 ^^
감사합니다~~