최신글 스킨에 답변글 RE 아이콘 나오게 하기~ 뺘셔~ > 그누3 팁자료실

그누3 팁자료실

최신글 스킨에 답변글 RE 아이콘 나오게 하기~ 뺘셔~ 정보

그누호환 최신글 스킨에 답변글 RE 아이콘 나오게 하기~ 뺘셔~

본문

우하하~ ㅡㅡ; 얼마전에 re 문제때문에 질문을 하고 해결을 했었습니다.
하지만... 답변을 다는 사람이 지워 버려서 문제가 되더군요 ㅜ.ㅜ
내부 리스트에서는 아이콘이 나와서 별 문제 없지만 최신글에는 구분이 않가서
고민하다가 이것 저것 해보다가 성공했습니다. 생각보다 간단하더군요.. ^^;;
먼저
lib 폴더에 있는
latest.lib.php의 소스중 // 코멘트 카운트 부분에 다음 내용을 추가 합니다.

$list[$i][re] = "";
if ($row[wr_reply] == "A") {
$list[$i][re] = "<img src='$latest_skin/icon_reply.gif' align=absmiddle>";
}

그리고 최신글 스킨에latest.skin.php 을 수정합니다
<?=$list[$i][subject]?> 앞에다가 <?=$list[$i][re]?>를 넣어 줍니다.

<?=$list[$i][re]?><?=$list[$i][subject]?> 게 되겠죠?
그림 re 아이콘이 나옵니다..
그리고 최신글 스킨 폴더에 icon_reply.gif 이미지를 넣습니다..

간단팁이지만... 좋은 팁이 되었으면 좋겠네요 ^^*

아래는 수정한 파일소스 입니다.

----------------------- latest.lib.php -------------------------------
<?
if (defined(__FILE__)) return;
define(__FILE__, TRUE);

//==============================================================================
// 최신글 관련 함수
//==============================================================================


// 최신글 추출
function latest($skin_dir='', $bo_table, $rows=10, $len=40)
{
global $latest_skin, $cfg;

$tmp_latest_skin = $latest_skin;

// 스킨디렉토리값이 넘어왔다면
if ($skin_dir) {
$latest_skin = "./bbs/skin/latest/$skin_dir";
}

$sql = " select * from $cfg[table_board] where bo_table = '$bo_table' ";
$bo = sql_fetch($sql);
$bo_subject = $bo[bo_subject];

$sql = " select *
from {$cfg[write_table_prefix]}{$bo_table}
where wr_comment = 0
order by wr_id desc limit 0, $rows ";
$result = sql_query($sql);
for ($i=0; $row = mysql_fetch_array($result); $i++) {
$list[$i] = $row;

$list[$i][href] = "./?doc=bbs/gnuboard.php&bo_table=$bo_table&wr_id=$row[wr_id]";

// 코멘트 카운트
$list[$i][commentcnt] = "";
if ($row[wr_commentcnt] > 0) {
$list[$i][commentcnt] = "($row[wr_commentcnt])";
}

$list[$i][name] = gblayer($row[mb_id], cut_str($row[wr_name],10), $row[wr_email], $row[wr_homepage]);
$list[$i][subject] = conv_subject($row[wr_subject], $len,"…");
$list[$i][content] = get_text($row[wr_content]);
$list[$i][date] = substr($row[wr_datetime],2,8);
$list[$i][re] = "";
if ($row[wr_reply] == "A") {
$list[$i][re] = "<img src='$latest_skin/icon_reply.gif' align=absmiddle>";
}

$list[$i][icon_new] = "";
if ($row[wr_datetime] >= date("Y-m-d H:i:s", time() - $bo[bo_new] * 3600)) {
$list[$i][icon_new] = "<img src='$latest_skin/icon_new.gif' align=absmiddle>";
}

for ($k=1; $k<=$cfg[file_count]; $k++) {
if (@preg_match($cfg[image_extension], $row["wr_file".$k])) {
$list[$i]["file_image".$k] = "./data/file/$bo_table/" . $row["wr_file".$k];
}
}

for ($k=1; $k<=$cfg[link_count]; $k++) {
if ($row["wr_link".$k]) {
$link[$i]["link".$k] = set_http(get_text(cut_str($row["wr_link".$k], 255)));
$link[$i]["link_href".$k] = "./?doc=bbs/gblink.php&$qstr&wr_id=$row[wr_id]&index=$k";
}
}
}
mysql_free_result($result);

include "$latest_skin/latest.skin.php";

$latest_skin = $tmp_latest_skin;
}
?>



------------------------latest.skin.php ----------------------------
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>

<table width=100% bgcolor=#FFFFFF cellpadding=0 cellspacing=0>
<tr><td colspan=2 height=10></td></tr>

<? for ($i=0; $i<count($list); $i++) { ?>
<? if ($i) { echo "<tr><td colspan=2 height=1 background='$latest_skin/dot_line.gif'></td></tr>"; } ?>
<tr>
<td width=30 align=center><img src='<?=$latest_skin?>/icon_li.gif'></td>
<td width='' height=20><a href='<?="./?doc=bbs/gnuboard.php&bo_table=$bo_table&wr_id={$list[$i][wr_id]}"?>'><span class=content><?=$list[$i][re]?><?=$list[$i][subject]?> <span style='font-size:8pt;'><?=$list[$i][commentcnt]?></span></span></a> <?=$list[$i][icon_new]?></td>
</tr>
<? } ?>

<? if (count($list) == 0) { echo "<tr><td colspan=2 align=center height=50>자료가 없습니다.</td></tr>"; } ?>

<tr><td colspan=2 height=5></td></tr>
</table>
추천
0

댓글 전체

간단하면서도 무척 유용한 팁이네요.... 저도 gbform.skin내용 다시 바꾸고 최신글을 이걸로 바까야겐네요
팁 공개 감사합니다.
답글이 여러개있는놈은 2번째부턴 안나오던데요
$list[$i][re] = "";
if (strlen($row[wr_reply]) > 0) {
for ($k=0; $k<strlen($row[wr_reply]); $k++) {
$list[$i][re] .= "<img src='$latest_skin/icon_reply.gif' align=absmiddle border=0> ";
}
}
요로케 하니깐
답글에 대한 답글은 re아이콘이 2개 나오네요. 와우맨님이 알려줘서 조금 수정해봤어요..
$list[$i][re] 이거 뒤에 점 지우면 무조건 re 아이콘 1개 나오고요
전체 1,026
그누3 팁자료실 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT