테스트 사이트 - 개발 중인 베타 버전입니다

새글등록시 전체글(new.php)리스트에 'new' 아이콘을 출력하는 방법 좀 알려주세요!!

· 12년 전 · 528 · 6
최신글처럼 새글 등록시 전체글리스트에 'new'아이콘을 노출시키고 싶은데요...

고수님들의 관련 팁 부탁드립니다...!

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

댓글 6개

new.skin.php 아래 코드를 수정해 보세요.
[code]
<?
for ($i=0; $i<count($list); $i++)
{
$gr_subject = cut_str($list[$i]['gr_subject'], 20);
$bo_subject = cut_str($list[$i]['bo_subject'], 20);
$wr_subject = get_text(cut_str($list[$i]['wr_subject'], 80));
?>
[/code]

수정된 코드
[code]
<?
for ($i=0; $i<count($list); $i++)
{
$gr_subject = cut_str($list[$i]['gr_subject'], 20);
$bo_subject = cut_str($list[$i]['bo_subject'], 20);
$wr_subject = get_text(cut_str($list[$i]['wr_subject'], 80));

// new icon 표시
$new_skin_url = G4_URL.str_replace("\\", "/", str_replace(G4_PATH, "", $new_skin_path));
$icon_new = '';
if ($list[$i]['wr_datetime'] >= date("Y-m-d H:i:s", G4_SERVER_TIME - (24 * 3600)))
$icon_new = '<img src="'.$new_skin_url.'/img/icon_new.gif" alt="새글">';
?>
[/code]

icon 이미지 경로는 수정하셔야 합니다.

그리고 수정된 코드에서는 24시간을 기준으로 처리하고 있는데요
시간을 변경하시려면 G4_SERVER_TIME - (24 * 3600))) 부분의 24를 다른 시간을 변경하시면 됩니다.
12년 전
감사합니다...

알려주신데로 코드삽입하고
아이콘출력부분에

<?=$list[$i]['icon_new']?>

이렇게 삽입했는데 아이콘 출력이 안되네요...
확인 부탁드립니다...
아이콘 출력 부분에 <?=$icon_new?> 라고 수정하셔야 합니다.
12년 전
감사합니다...^^
12년 전
뉴아이콘이 처음에 보이더니....

따로 건드린것이 없는데
새글을 등록해도 지금은 안보이네요...;;;;;;;;;;

제 코드에 문제가 있는지 시간되심 검토 부탁드립니다...;;

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
include_once(G4_LIB_PATH.'/thumbnail.lib.php');
global $is_admin;

$latest_img_width = 70; //이미지 가로 크기
$latest_img_height = 70; //이미지 세로 길이
?>

<link rel="stylesheet" href="<?php echo $new_skin_url; ?>/style.css">

<!-- 검색 -->
<fieldset id="new_sch">
<legend>상세검색</legend>
<form name="fnew" method="get">
<?=$group_select?>
<select name="view" id="view" title="검색종류">
<option value="">전체게시물
<option value="w">원글만
<option value="c">코멘트만
</select>
<input type="text" name="mb_id" value="<?=$mb_id?>" id="mb_id" title="검색어(필수)" required class="frm_input requird">
<input type="submit" value="검색" class="btn_submit">
</form>
<script>
/* 셀렉트 박스에서 자동 이동 해제
function select_change()
{
document.fnew.submit();
}
*/
document.getElementById("gr_id").value = "<?=$gr_id?>";
document.getElementById("view").value = "<?=$view?>";
</script>
</fieldset>
<!-- 검색 끝 -->

<!-- 제목 시작 -->
<center>
<div class="n_latest_wrap2">
<?
for ($i=0; $i<count($list); $i++)
{
$gr_subject = cut_str($list[$i]['gr_subject'], 20);
$bo_subject = cut_str($list[$i]['bo_subject'], 20);
$wr_subject = get_text(cut_str($list[$i]['wr_subject'], 80));
// 이미지추출
$lt_thumb = get_list_thumbnail($list[$i][bo_table], $list[$i]['wr_id'], $latest_img_width, $latest_img_height);
$It_noimg = "$new_skin_url/img/noimg.gif";
if($lt_thumb['src']) {
$img_content = '<img alt="'.$lt_thumb['alt'].'" src="'.$lt_thumb['src'].'" width="'.$latest_img_width.'" height="'.$latest_img_height.'">';
} else {
$img_content = '<img src="'.$It_noimg.'" width="'.$latest_img_width.'" height="'.$latest_img_height.'">'; // no img 대신에 그냥 출력안되게 변경

// new icon 표시
$new_skin_url = G4_URL.str_replace("\\", "/", str_replace(G4_PATH, "", $new_skin_path));
$icon_new = '';
if ($list[$i]['wr_datetime'] >= date("Y-m-d H:i:s", G4_SERVER_TIME - (24 * 3600)))
$icon_new = '<img src="'.$new_skin_url.'/img/icon_new.gif" alt="새글">';
}
?>
<ul>
<li class="n_list">
<table border='0' cellpadding='0' cellspacing='0'>
<tr>
<td valign='top'>
<span class='n_img'>
<!-- 썸네일시작 -->
<a href="<?php echo $list[$i]['href']; ?>">
<?=$img_content;?>
</a>
<!-- 썸네일끝 -->
</span>
</td>
<td width='5'></td>
<td valign='top'>
<table border='0' cellpadding='0' cellspacing='0'>
<tr>
<td valign='top'>
<span class='n_tit'><a href="<?=$list[$i]['href']?>"><strong><?=$list[$i]['comment']?><?=$wr_subject?></strong></a></span>
</td>
</tr>
<tr><td height='5'></td></tr>
<tr>
<td>
<?=cut_str(strip_tags($list[$i][wr_content]),60,"...")?>
</td>
</tr>
<tr><td height='5'></td></tr>
<tr>
<td>
<table width='100%' border='0' cellpadding='0' cellspacing='0'>
<tr>
<td width='65'>
<span><?=$list[$i]['datetime']?></span>
</td>
<td width='15'>
<span><?=$icon_new?></span>
</td>
<td width='20'>
<span><? if($list[$i]['wr_comment'] > 0) echo "(".$list[$i]['wr_comment'].")";?></span>
</td>
<td>
<span><a href="<?=G4_BBS_URL?>/board.php?bo_table=<?=$list[$i]['bo_table']?>">[<?=$bo_subject?>]</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr><td height='5'></td></tr>
</table>
</td>
</tr>
</table>
<table width='100%' cellpadding='0' cellspacing='0'>
<tr><td height='1' style='border-bottom:1px dotted #ebebeb;'></td></tr>
</table>
</li>
</ul>

<? } ?>

<? if ($i == 0)
echo "<tr><td colspan=\"5\" class=\"empty_table\">게시물이 없습니다.</td></tr>";
?>
</div>
</center>
<?=$write_pages?>
12년 전
따로 빼니까 해결이 되네요..
비슷한 경우 계시분들 응용하세요...

<?
// new icon 표시
$new_skin_url = G4_URL.str_replace("\\", "/", str_replace(G4_PATH, "", $new_skin_path));
$icon_new = '';
if ($list[$i]['wr_datetime'] >= date("Y-m-d H:i:s", G4_SERVER_TIME - (24 * 3600)))
$icon_new = '<img src="'.$new_skin_url.'/img/icon_new.gif" alt="새글">';
?>

게시글 목록

번호 제목
4105
4099
4090
4087
4085
4083
4077
4060
4056
4055
4050
4046
4043
4041
4038
4031
4026
4025
4024
4017