특정기간동안 특정링크가 나타나도록 하고 싶은데요. 정보
특정기간동안 특정링크가 나타나도록 하고 싶은데요.본문
예를들어 2007년 4월1일부터 4월3일 동안에는 [이벤트] 항목이 나타나
클릭하면 이곳으로 이동하도록 하고 싶은데 어떻게 해야할까요?
댓글 전체
여분필드에 날짜를 입력(wr_1, wr_2) 받으시고
화면 뿌릴때 날짜를 비교하여 오늘이 그 날짜 사이이면
링크를 활성화 되도록 처리하시면 되겠습니다.
화면 뿌릴때 날짜를 비교하여 오늘이 그 날짜 사이이면
링크를 활성화 되도록 처리하시면 되겠습니다.
![](http://sir.kr/data/member_image/ie/iemdic.gif?1196728012)
root님 의견에 더해서
if ($list[$i][wr_1] > date("Y-m-d H:i", $g4['server_time'])&&$list[$i][wr_2] < date("Y-m-d H:i", $g4['server_time']))
{
echo "<font color=red><b><a href="이동할 경로">[이벤트]</a></b></font>";
}
else
{
echo "<font color=black>이벤트 기간이 아닙니다.</font>";
}
if ($list[$i][wr_1] > date("Y-m-d H:i", $g4['server_time'])&&$list[$i][wr_2] < date("Y-m-d H:i", $g4['server_time']))
{
echo "<font color=red><b><a href="이동할 경로">[이벤트]</a></b></font>";
}
else
{
echo "<font color=black>이벤트 기간이 아닙니다.</font>";
}
몰랐던 것도 질문만 하면 다른 분들 도움을 받았던 스스로 알아지건 간에 문제가 해결되는 것이 신기합니다. 다른 분들을 위해서 제가 보충해서 올립니다.
세 개중에 하나 선택하면 될 것 같습니다.
$date = "1";
$date1 = "30"; //기간
$today_time = date("Y-m-d H:i:s"); //오늘 날짜
$time = date("Y-m-d H:i:s", strtotime($view[wr_datetime]) + ($date * 86400));
$time1 = date("Y-m-d H:i:s", strtotime($view[wr_datetime]) + ($date1 * 86400));
if ($today_time >= $time && $today_time < $time1) {
echo "<font color=red><b><a href='이동할 경로'>[이벤트]</a></b></font>";
}
else
{
echo "<font color=black>이벤트 기간이 아닙니다.</font>";
}
$date= '20070313';
$date1= '20070317';
$currentYear = date('Y');
$currentMonth = date('m');
$currentDay = date('d');
$DDAY=mktime(0,0,0,$currentMonth,$currentDay,$currentYear) - mktime(0,0,0,substr($date,4,2),substr($date,6,2),substr($date,0,4));
$DDAY1=mktime(0,0,0,$currentMonth,$currentDay,$currentYear) - mktime(0,0,0,substr($date1,4,2),substr($date1,6,2),substr($date1,0,4));
$DDAY=($DDAY/86400);
$DDAY1=($DDAY1/86400);
if ($DDAY >= 0 && $DDAY1 < 0) {
echo "<font color=red><b><a href='이동할 경로'>[이벤트]</a></b></font>";
}
else
{
echo "<font color=black>이벤트 기간이 아닙니다.</font>";
}
$wtime=date("Ymd");
$date= '20070314';
$date1= '20070318';
$today_time = $wtime - $date;
$today_time1 = $wtime - $date1;
if ($today_time >= 0 && $today_time1 < 0) {
echo "<font color=red><b><a href='이동할 경로'>[이벤트]</a></b></font>";
}
else
{
echo "<font color=black>이벤트 기간이 아닙니다.</font>";
}
세 개중에 하나 선택하면 될 것 같습니다.
$date = "1";
$date1 = "30"; //기간
$today_time = date("Y-m-d H:i:s"); //오늘 날짜
$time = date("Y-m-d H:i:s", strtotime($view[wr_datetime]) + ($date * 86400));
$time1 = date("Y-m-d H:i:s", strtotime($view[wr_datetime]) + ($date1 * 86400));
if ($today_time >= $time && $today_time < $time1) {
echo "<font color=red><b><a href='이동할 경로'>[이벤트]</a></b></font>";
}
else
{
echo "<font color=black>이벤트 기간이 아닙니다.</font>";
}
$date= '20070313';
$date1= '20070317';
$currentYear = date('Y');
$currentMonth = date('m');
$currentDay = date('d');
$DDAY=mktime(0,0,0,$currentMonth,$currentDay,$currentYear) - mktime(0,0,0,substr($date,4,2),substr($date,6,2),substr($date,0,4));
$DDAY1=mktime(0,0,0,$currentMonth,$currentDay,$currentYear) - mktime(0,0,0,substr($date1,4,2),substr($date1,6,2),substr($date1,0,4));
$DDAY=($DDAY/86400);
$DDAY1=($DDAY1/86400);
if ($DDAY >= 0 && $DDAY1 < 0) {
echo "<font color=red><b><a href='이동할 경로'>[이벤트]</a></b></font>";
}
else
{
echo "<font color=black>이벤트 기간이 아닙니다.</font>";
}
$wtime=date("Ymd");
$date= '20070314';
$date1= '20070318';
$today_time = $wtime - $date;
$today_time1 = $wtime - $date1;
if ($today_time >= 0 && $today_time1 < 0) {
echo "<font color=red><b><a href='이동할 경로'>[이벤트]</a></b></font>";
}
else
{
echo "<font color=black>이벤트 기간이 아닙니다.</font>";
}