급질문드립니다. ㅠㅠ 정보
급질문드립니다. ㅠㅠ본문
<?
$today=date('Y-m-d');
if( $today == $row->c_date){
?>
<img src='img/new_icon.gif' />
<?
}
?>
현재 새글작성시 아이콘이 하루만 노출되는데 일주일이나
한달로 연장하려면 코드를 어떻게 고쳐야하나요 ㅠㅠ
고수님 부탁드려요
원본코드
<script language="JavaScript" type="text/JavaScript">
<!--
function mail_open(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)
{
toolbar_str = toolbar ? 'yes' : 'no';
menubar_str = menubar ? 'yes' : 'no';
statusbar_str = statusbar ? 'yes' : 'no';
scrollbar_str = scrollbar ? 'yes' : 'no';
resizable_str = resizable ? 'yes' : 'no';
window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}
//-->
</script>
<? include '../board4_head.htm'?>
<table width="495" height="154" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="26"> </td>
</tr>
<tr>
<td><table width="482" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td><table width="482" border="0" cellspacing="0" cellpadding="0">
<!--tr>
<td height="20"align="right">
<?if(!session_is_registered(USERID)){?>
<a href="javascript:mail_open('adminwin', 'login_proc.php', 300, 70, 340, 250, 0, 0, 0, 0, 0);"><img src="img/admin_login.gif" border="0"></a>
<?}
else{?>
<a href="logout.php" target="log_out"><img src="img/log_out.gif" border="0"></a>
<?}?>
<iframe src="" name="log_out" width="0" height="0" marginwidth="0" marginheight="0" frameborder="no"></iframe>
</td>
</tr>
<tr>
<?if(session_is_registered(USERID)){?>
<td width="65" height=1 bgcolor=""></td>
<?}
else{?>
<td></td>
<?}?>
</tr-->
</table></td>
</tr>
<tr>
<td background="img/title_bg.gif"><table width="482" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="39" height="30"><div align="center"><font color="bf8c71" size="2" face="돋움체"><b>번호</b></font></div></td>
<td width="311"><div align="center"><font color="bf8c71" size="2" face="돋움체"><b>제 목</b></font></div></td>
<td width="76"><div align="center"><font color="bf8c71" size="2" face="돋움체"><b>이 름</b></font></div></td>
<td width="56"><div align="center"><font color="bf8c71" size="2" face="돋움체"><b>조회수</b></font></div></td>
</tr>
</table></td>
</tr>
<?
////////////////
function substring($string,$position,$length=0) {
$a=0;$b=0;$c=0;$startposition=0;$chk=true;$chkposition=false;$length_count=0;
$cnt=strlen($string);
$i=0;
for($i=0;$i<$cnt;$i++) {//0,1
if(!$chkposition) {
if(($a+$c)==$position) {
if($chk)$startposition=$i;
else $startposition=$i-1;
$chkposition=true;
$a=0;$b=0;$c=0;
}
}
else {
if(($a+$c)<$length) $length_count++;
else break;
}
$ascii=ord($string[$i]);
if($ascii<=127) $a++;//1,
else {
$b++;//1,
$chk=false;
if($b%2==0) {
$c++;
$chk=true;
}
}
}
return substr($string,$startposition,$length_count+1);
}
if($search)
{
if($select == "제목"){
$db->query("select * from board4 where c_title like '%$search%' order by ref DESC,re_step asc,c_date desc");
}
}
else
$db->query("select * from board4 order by ref DESC,re_step asc,c_date desc ");
$totalCount = $db->row_count();
$total = $db->row_count();
$recPg = 10;
$totalPg = ceil($totalCount/$recPg);
if(!$nPage) $nPage=1;
$startP = ($nPage-1)*$recPg;
$endP = $recPg;
$total = $total-(($nPage*$recPg)-$recPg);
$a=$total;
// page
include "../lib/pageskin.php";
//생성자 (URL, 데이터전체갯수, 라인줄수, 하단페이지이동갯수)
$pageSkip = new pageSkip($SCRIPT_NAME."?search=$search&period=$period&nPage=", $totalCount, $recPg, 10);
////////////////
if($search)
{
if($select == "제목"){
$db->query("select * from board4 where c_title like '%$search%' order by ref DESC,re_step asc,c_date desc limit $startP, $endP ");
}
}
else
$db->query("select * from board4 order by ref DESC,re_step asc,c_date desc limit $startP, $endP");
$b=1;
?>
<tr>
<td height="30"><table width="482" border="0" cellspacing="0" cellpadding="0">
<?
for($d=2;$d<=$b;$d++){
if($b == $d){
$color="#f7f7f7";
}
else{
$color="#ffffff";
}
$d++;
}
while($row = $db->row()) {
?>
<!--TR ALIGN=CENTER HEIGHT=27 BGCOLOR='<?=$color?>' onmouseover="this.style.background='d2b48c';" onmouseout="this.style.background='<?=$color?>';"-->
<tr onmouseover="this.style.background='533636';" onmouseout="this.style.background='';">
<td width="39" height="30" align="center"><?=$a?></td>
<td width="311" align="left"><?
if($row->re_level > 0){
$wid=$row->re_level;
for($i=0;$i<=$wid;$i++){
echo " ";
}
// echo "└ <a href=read.htm?nPage=".$nPage."&t_idx=".$row->c_idx."&t_i=".$i.">".$db_title=substring($row->c_title,0,30)."..</a>";
echo "└ <a href=\"javascript:mail_open('adminwin', 'login_proc2.htm?t_i=$i&nPage=$nPage&menu_url=read&idx=$row->c_idx&pass_idx=$row->ref', 300, 70, 340, 250, 0, 0, 0, 0, 0);\">".$db_title=substring($row->c_title,0,30)."..</a>";
}
else{
//echo "<a href=read.htm?nPage=".$nPage."&t_idx=".$row->c_idx."&t_i".$i.">".$db_title=substring($row->c_title,0,40)."..</a>";
echo "<a href=\"javascript:mail_open('adminwin', 'login_proc2.htm?nPage=$nPage&menu_url=read&idx=$row->c_idx&pass_idx=$row->ref', 300, 70, 340, 250, 0, 0, 0, 0, 0);\">".$db_title=substring($row->c_title,0,40)."..</a>";
}
?>
<?
$today=date('Y-m-d');
$day = "2009-11-19"
$afterDay = date("Y-m-d", strtotime($day." +7 day"));
if( $today <= $afterDay){
?>
<img src='img/new_icon.gif' />
<?
}
?>
</td>
<td width="76" align="center"><?=$row->c_name?></td>
<td width="56" align="center"><?=$row->c_hit?></td>
</tr>
<tr>
<td height="1" colspan="6" bgcolor="#f7f7f7"></td>
</tr>
<?
$b++;
$a--;
}
?>
</table></td>
</tr>
<tr>
<td><table width="482" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="30" align="center">[
<?=$pageSkip->printPage($nPage);?>
] </td>
</tr>
</table></td>
</tr>
<tr>
<td height="20"><table width="482" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="300"><form action="<?=$SELF_PHP?>" method="post" name="f_search" id="f_search">
<select name="select">
<option value="제목">제목</option>
</select>
<input type="text" name="search" size="20" />
<input name="image" type="image" src="img/search.gif" align="absmiddle" />
</form></td>
<td width="100"> </td>
<td width="200" valign="top" align="right"><!--a href="javascript:mail_open('adminwin', 'login_proc.php?menu_url=write', 300, 70, 340, 250, 0, 0, 0, 0, 0);"-->
<a href="write.htm?nPage=<?=$nPage?>"><img src="img/write.gif" border='0'
align="absmiddle" /></a> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<? include '../board_tail.htm'?>
댓글 전체
스킨을 관리자 모드로 열었을 때 그 화면에서
new 이미지 [입력값] 글 입력후 new 이미지를 출력하는 시간
이 부분에 숫자를 지정한 대로 new이미지가 붙게 되어 있습니다.
일주일이면 24*7=168 을 입력하면 되겠습니다.
$day=date("Y-m-d", strtotime("-7 day"));
if( $row->c_date >= $day ){
?>
<img src='img/new_icon.gif' />
<?
}
?>