3.23버전 최신글에 카테고리 출력하기 정보
그누호환 3.23버전 최신글에 카테고리 출력하기
본문
********** lib/latest.lib.php 내용 수정 ****************
<?
if (defined(__FILE__)) return;
define(__FILE__, TRUE);
//==============================================================================
// 최신글 관련 함수
//==============================================================================
// 최신글 추출
function latest($skin_dir='', $bo_table, $title, $rows=10, $len=40, $con)
{
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(cut_str($row[wr_content], $con,"…"));
$list[$i][date] = substr($row[wr_datetime],2,8);
$table = "{$cfg[write_table_prefix]}{$bo_table}";
$is_category = false;
if ($bo[bo_use_category]) {
$is_category = true;
$category_option = get_category_option($table);
}
$list[$i][ca_name] = get_category_name($table, $row[ca_id]);
$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;
}
?>
************ skin/latest/basic/latest.skin.php 수정 **************
<table width=100% bgcolor=#FFFFFF cellpadding=0 cellspacing=0>
<tr><td 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 align=left height=25><? if ($is_category) { ?><span class=tt>[<?=$list[$i][ca_name]?>]</span><? } ?><img src='<?=$latest_skin?>/icon_li.gif'>
<a href='<?="./?doc=bbs/gnuboard.php&bo_table=$bo_table&wr_id={$list[$i][wr_id]}"?>'><span class=content><?=$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 height=5></td></tr>
</table>
위의 내용처럼 하시면 잘 됩니다.
<?
if (defined(__FILE__)) return;
define(__FILE__, TRUE);
//==============================================================================
// 최신글 관련 함수
//==============================================================================
// 최신글 추출
function latest($skin_dir='', $bo_table, $title, $rows=10, $len=40, $con)
{
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(cut_str($row[wr_content], $con,"…"));
$list[$i][date] = substr($row[wr_datetime],2,8);
$table = "{$cfg[write_table_prefix]}{$bo_table}";
$is_category = false;
if ($bo[bo_use_category]) {
$is_category = true;
$category_option = get_category_option($table);
}
$list[$i][ca_name] = get_category_name($table, $row[ca_id]);
$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;
}
?>
************ skin/latest/basic/latest.skin.php 수정 **************
<table width=100% bgcolor=#FFFFFF cellpadding=0 cellspacing=0>
<tr><td 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 align=left height=25><? if ($is_category) { ?><span class=tt>[<?=$list[$i][ca_name]?>]</span><? } ?><img src='<?=$latest_skin?>/icon_li.gif'>
<a href='<?="./?doc=bbs/gnuboard.php&bo_table=$bo_table&wr_id={$list[$i][wr_id]}"?>'><span class=content><?=$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 height=5></td></tr>
</table>
위의 내용처럼 하시면 잘 됩니다.
추천
0
0
댓글 전체
작년데이타지만 공부에 도움이 될듯합니다. 좋은 자료 감사합니다.

<? if ($is_category) { ?><span class=tt>[<?=$list[$i][ca_name]?>]</span><? } ?>
위의 부분이 카테고리 출력부분인데 입맛에 맞게 수정을 하시면 될 듯합니다....^^
위의 부분이 카테고리 출력부분인데 입맛에 맞게 수정을 하시면 될 듯합니다....^^
아~! 항상 감사 드립니다 제가 워낙 무지 해서 그렇습니다.
에러메세지가 그걸 의미 하는것인지 전혀 예측 못했군여... 에궁.
지금 너무 잘 되고 있습니다...
다시한번 감사 드립니다......
에러메세지가 그걸 의미 하는것인지 전혀 예측 못했군여... 에궁.
지금 너무 잘 되고 있습니다...
다시한번 감사 드립니다......

function latest($skin_dir='', $bo_table, $title, $rows=10, $len=40, $con)
죄송합니다. 제가 조금만 더 세심하게 살폈으면 고생하지 않으실텐데 죄송합니다...
새글의 업버전과 제가 약간 다르게 만들었습니다. 이유는 라이브러리에서 지정되면
웹페이지에서 숫자 조정만을 가지고 가능 했기 때문인데 꼭 위의 방법이 아니더라도
막고 품는 식의 방법이 있기는 합니다마는 저는 위의 내용을 선호하는 편입니다.
위의 내용을 보면 총 6개의 변수를 입력해야 합니다.
function latest(스킨디렉토리, 게시판명, 게시판 제목, 뽑을제목갯수, 제목글자수, 내용글자수)
최근게시물을 출력하실 때에 아래의 형식대로 하시면 문제 없으실 겁니다...
<? latest('a_notice', jang_1, '좋은교회 소식', 3, 30, 500); ?>
<? latest('스킨디렉토리', 게시판명, '게시판 제목', 뽑을제목갯수, 제목글자수, 내용글자수); ?>
잘되시길 바랍니다.....*^^*
죄송합니다. 제가 조금만 더 세심하게 살폈으면 고생하지 않으실텐데 죄송합니다...
새글의 업버전과 제가 약간 다르게 만들었습니다. 이유는 라이브러리에서 지정되면
웹페이지에서 숫자 조정만을 가지고 가능 했기 때문인데 꼭 위의 방법이 아니더라도
막고 품는 식의 방법이 있기는 합니다마는 저는 위의 내용을 선호하는 편입니다.
위의 내용을 보면 총 6개의 변수를 입력해야 합니다.
function latest(스킨디렉토리, 게시판명, 게시판 제목, 뽑을제목갯수, 제목글자수, 내용글자수)
최근게시물을 출력하실 때에 아래의 형식대로 하시면 문제 없으실 겁니다...
<? latest('a_notice', jang_1, '좋은교회 소식', 3, 30, 500); ?>
<? latest('스킨디렉토리', 게시판명, '게시판 제목', 뽑을제목갯수, 제목글자수, 내용글자수); ?>
잘되시길 바랍니다.....*^^*
박갑성님 팁 정말 감사 합니다. 그런데......
전 아직도 에러가 남아서여... 제가 새로운 버젼으로 업 하는
과정에 멀 잘 못 한것인지...
Warning: Missing argument 6 for latest() in /home/jack2247/open/lib/latest.lib.php on line 11
이런 메세지가 계속 나타나고 제한된 글수만큼만 출력 되던 것이 있는데로 다
출력 되어 버리네요.....
http://jack2247.woweb.net/
얼마간 딴짓 하다가 다시 조금 해볼라니 어렵군여...
그냥 아무도 오지 않는 개인 홈이라 특별히 중요한것은 없지만
잘 되던것이 않되니 답답하군여...
전 아직도 에러가 남아서여... 제가 새로운 버젼으로 업 하는
과정에 멀 잘 못 한것인지...
Warning: Missing argument 6 for latest() in /home/jack2247/open/lib/latest.lib.php on line 11
이런 메세지가 계속 나타나고 제한된 글수만큼만 출력 되던 것이 있는데로 다
출력 되어 버리네요.....
http://jack2247.woweb.net/
얼마간 딴짓 하다가 다시 조금 해볼라니 어렵군여...
그냥 아무도 오지 않는 개인 홈이라 특별히 중요한것은 없지만
잘 되던것이 않되니 답답하군여...