1일~3일 과 같은 중복일정도 최신일정으로 뽑으려면 어찌해야할런지요~
현재 00일~00일까지 시작일과 종료일로 작성한 일정이 달력목록에는 뜨지만
최신글 뽑을때는 시작일에 해당되는 날에만 일정이 나오고 그 이후 종료일까지의 일정은
뽑아져 나오지가 않습니다 ㅠㅠ
방법 부탁드려요
일정 소스가 두개입니다
하나는 이번주 일정 뽑는 소스
<?include_once("$g4[path]/head.sub.php");$bo_table2 = 'g4_write_'.$bo_table;// 이번달 첫날 구하기$today = date("d");$start = date("Ym").$today-2; // $today에 변수저장 안하고 바로 쓰셔도 되요.$end = date("Ym").$today+7; // 1주일은 7일이 맞죠??$sql = "SELECT * FROM $bo_table2 where wr_link1 > $start and wr_link1 < $end order by wr_link1";$query = mysql_query($sql);$row = mysql_fetch_array($query); ?><link href="/style.css" rel="stylesheet" type="text/css" /><table width="280" border="0" cellspacing="1" cellpadding="0"> <? while($row = mysql_fetch_array($query)){ $datee=$row[wr_link1]; ?> <tr> <td height=21><img src="http://jjcy.or.kr/skin/latest/bara_latest/img/latest_icon.gif"> <font style='font-family:돋움; font-size:10pt; color:#2C88B9;'>[<? // echo substr($datee,0,4)."년". ?><? echo sprintf("%2d",substr($datee,4,2))."월".sprintf("%2d",substr($datee,6,2))."일"; ?>]</font></td><td align="left"><font style='font-family:돋움; font-size:10pt; color:#2C88B9;'><a href="<?=$g4[path]?>/bbs/board.php?bo_table=<?=$bo_table?>&wr_id=<?=$row[wr_id]?>" target="_parent"><?=$row[wr_subject];?> </a> </font> </td> </tr> <tr ><td height='1' colspan='2' background='<?=$g4[path]?>/2014_index/line.gif'></td></tr> <? } ?> </table>
두번째는 1주 / 2주 / 별로 뽑는 탭최신일정소스입니다.
<??><table width=100% cellpadding=0 cellspacing=0><? for ($i=0; $i<count($list); $i++) { ?><tr> <td colspan=4 align=center> <table width=280> <tr> <td height=20 align="left"><img src="http://jjcy.or.kr/skin/latest/bara_latest/img/latest_icon.gif"> <? $date = substr($list[$i]['link'][1], 7); echo $date; ?> <? echo $list[$i]['icon_reply'] . " "; echo "<a href='{$list[$i]['href']}'>"; if ($list[$i]['is_notice']) echo "<font style='font-family:돋움; font-size:10pt; color:#2C88B9;'><strong>{$list[$i]['subject']}</strong></font>"; else echo "<font style='font-family:돋움; font-size:10pt; color:#6A6A6A;'>{$list[$i]['subject']}</font>"; echo "</a>"; ?> </td></tr> </table></td></tr> <tr><td height='1' colspan='2' background='<?=$g4[path]?>/2014_index/line.gif'></td></tr><? } ?><? if (count($list) == 0) { ?><tr align=left><td colspan=4 align=center height=50><font color=#6A6A6A>게시물이 없습니다.</a></td></tr><? } ?></table>
답변 2개
원하시는 내용이 먼지 정확히 파악은 못하겠네요.
한번, lib/latest.lib.php에서
$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_num limit 0, $rows ";
에서 wr_num 을 wr_link1로 바까보세요.
원하시는 결과값인지.. (최신글보기가 다껴버릴테니, $bo_table=="해당테이블" 일때만 조건걸고요.)
아~ 감사합니다~~
1일부터 3일까지 3일간 캠프를 한다고하면
달력에는 같은 제목의 일정이 1,2,3일날 다 나오는데요
최신일정에는 시작일만 뽑아져나와서요~
2,3일도 다 뽑아져 나왔으면 하는 질문이였어요 ㅋㅋ
제가 제대로 설명을 못한듯해요 ㅋ
그나저나
저야말로 ㅠㅠ 말씀해주신대로 적용을 제대로 했는지 모르겠어요 ㅠㅠ
ㅋ
<??>// 최신글 추출function latest($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options=""){ global $g4; if ($skin_dir) $latest_skin_path = "$g4[path]/skin/latest/$skin_dir"; else $latest_skin_path = "$g4[path]/skin/latest/basic"; $list = array();$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_link1 limit 0, $rows "; $bo_table="plan"; $sql = " select * from $g4[board_table] where bo_table = '$bo_table'"; $board = sql_fetch($sql); $tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름 //$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_id desc limit 0, $rows "; // 위의 코드 보다 속도가 빠름 $sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_num limit 0, $rows "; //explain($sql); $result = sql_query($sql); for ($i=0; $row = sql_fetch_array($result); $i++) $list[$i] = get_list($row, $board, $latest_skin_path, $subject_len); ob_start(); include "$latest_skin_path/latest.skin.php"; $content = ob_get_contents(); ob_end_clean(); return $content;} //============================================================= function latest_schedule($skin_dir='', $bo_table) { global $config; global $g4; global $year, $month; // 스킨디렉토리값이 넘어왔다면 if ($skin_dir) { $latest_skin_path = "./$g4[path]/skin/latest/$skin_dir"; } $write_table = $g4[write_prefix] . $bo_table; ob_start(); include "$latest_skin_path/latest.skin.php"; $content = ob_get_contents(); ob_end_clean(); return $content; } // 그룹이름 추출 function print_gr_subject($gr_id) { global $g4; $sql = " select * from $g4[group_table] where gr_id = '$gr_id'"; $gr_sub = sql_fetch($sql); return $gr_sub[gr_subject]; } ?>
답변을 작성하려면 로그인이 필요합니다.