최신글 무지하게 헤메고 있습니다. 정보
최신글 무지하게 헤메고 있습니다.본문
최신게시물까지는 됐는데 아직 그누개념이 정립이 제대로 되지 않아서인지 ...하여간 완전히 헤메고 있습니다.
다른분들은 쉬워서 질문할 거리도 아닌건지 아니면 제 검색실력이 하찮아서 그런건지 검색으로 답을 얻는게 쉽지가 않습니다.
만약 너무 기본적인 질문일지라도 너무 노여워하지 말아주십시요.
인덱스페이지에 최신글을 불러오려고 합니다.
어떤 특정게시판이 아니라 전체 그룹게시판에서 새로 등록된 글은 무조건 처음 인덱스화면에 최신글부분에서 확인할 수 있게 하려고 합니다.
게시물 뿐아니라 코멘트가 등록되어도 최신글에 나오게 하고 싶습니다.
쉽게 말해서 관리자 화면에 신규가입화면 5건, 최근 게시물 5건, 최근 포인트 5건 이렇게 나오지 않습니까?
그중 최근게시물 5건 부분처럼 전체 게시판에서 최근에 등록한 글들을 모두 뽑아서 인덱스 페이지에 보이고 싶은겁니다.
아직은 방문자가 많지 않아 게시물로 많지 않기때문에 방문자들이 그냥 인덱스페이지에서 새로 등록된 게시물로 해당 게시판으로 이용하게끔 하려고 합니다.
어떻게 인덱스페이지에 최신글을 구현해야 하는지 답변 좀 부탁드립니다.
댓글 전체
//정확한 질문의 답은 못되는것 같네요,,
새로만드신 인덱스에 그누보드를 얹으시는건가요?
그럼,추출하기가 저같은 초보에겐 꽤 어렵습니다.
경로설정이나 여러소스들을 다시 손봐야 하기 때문이죠,,
그게아니고 그누보드를 그대로 쓰시면서 게시판보이게하는건
admin으로 접속하신후 게시판그룹추가하고
게시판추가해주면 됩니다.
-참고-
http://www.sir.co.kr/bbs/tb.php/g4_tiptech/1843/b4b5634dab612cac8939c8636bacad9f
정확하게 일치하는 내용은 아니지만,여기가시면 조금 도움이 되실듯하네요,,
그룹내의 글이 보여지고,이미지도 함께 불러지는 것입니다.
저도,헤매고 있습니다.우리 서로 도우면서해요..ㅜ.ㅜ::
새로만드신 인덱스에 그누보드를 얹으시는건가요?
그럼,추출하기가 저같은 초보에겐 꽤 어렵습니다.
경로설정이나 여러소스들을 다시 손봐야 하기 때문이죠,,
그게아니고 그누보드를 그대로 쓰시면서 게시판보이게하는건
admin으로 접속하신후 게시판그룹추가하고
게시판추가해주면 됩니다.
-참고-
http://www.sir.co.kr/bbs/tb.php/g4_tiptech/1843/b4b5634dab612cac8939c8636bacad9f
정확하게 일치하는 내용은 아니지만,여기가시면 조금 도움이 되실듯하네요,,
그룹내의 글이 보여지고,이미지도 함께 불러지는 것입니다.
저도,헤매고 있습니다.우리 서로 도우면서해요..ㅜ.ㅜ::
http://www.sir.co.kr/bbs/board.php?bo_table=g4_skin&wr_id=17903&sca=%C3%D6%B1%D9%B0%D4%BD%C3%B9%B0&page=3
<a href="<?=$g4[bbs_path]?>/new.php">최근게시물</a>
이런것 말하는지요?
<a href="<?=$g4[bbs_path]?>/new.php">최근게시물</a>
이런것 말하는지요?
최근 게시물 왜 이렇게 힘든지..;;
1) lib/latest.lib.php 에 최근게시물 추출 기능을 하는 함수가 정의되어 있습니다.
// 최신글 추출
function latest($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
{
global $g4;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/basic";
$list = array();
$sql = " select * from $g4[board_table] where bo_table = '$bo_table'";
$board = sql_fetch($sql);
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
//$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_id desc limit 0, $rows ";
// 위의 코드 보다 속도가 빠름
$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_num limit 0, $rows ";
//explain($sql);
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++)
$list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
2) skin/latest/***/latest.skin.php 파일
*** skin을 적용한 게시판에서 최근게시물 관련 정보를 추출, 화면 처리 합니다.
<table width=100% cellpadding=0 cellspacing=0>
<colgroup width=14>
<colgroup>
<colgroup width=37>
<colgroup width=14>
<tr>
<td><img src='<?=$latest_skin_path?>/img/latest_t01.gif'></td>
<td background='<?=$latest_skin_path?>/img/bg_latest.gif'> <strong><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><?=$board[bo_subject]?></a></strong></td>
<td background='<?=$latest_skin_path?>/img/bg_latest.gif'><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><img src='<?=$latest_skin_path?>/img/more.gif' border=0></a></td>
<td><img src='<?=$latest_skin_path?>/img/latest_t02.gif'></td>
</tr>
<? for ($i=0; $i<count($list); $i++) { ?>
<tr>
<td colspan=4 align=center>
<table width=95%>
<tr>
<td height=25><img src='<?=$latest_skin_path?>/img/latest_icon.gif' align=absmiddle>
<?
echo $list[$i]['icon_reply'] . " ";
echo "<a href='{$list[$i]['href']}'>";
if ($list[$i]['is_notice'])
echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list[$i]['subject']}</strong></font>";
else
echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list[$i]['subject']}</font>";
echo "</a>";
if ($list[$i]['comment_cnt'])
echo " <a href=\"{$list[$i]['comment_href']}\"><span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list[$i]['comment_cnt']}</span></a>";
// if ($list[$i]['link']['count']) { echo "[{$list[$i]['link']['count']}]"; }
// if ($list[$i]['file']['count']) { echo "<{$list[$i]['file']['count']}>"; }
echo " " . $list[$i]['icon_new'];
echo " " . $list[$i]['icon_file'];
echo " " . $list[$i]['icon_link'];
echo " " . $list[$i]['icon_hot'];
echo " " . $list[$i]['icon_secret'];
?></td></tr>
<tr><td bgcolor=#EBEBEB height=1></td></tr>
</table></td>
</tr>
<? } ?>
<? if (count($list) == 0) { ?><tr><td colspan=4 align=center height=50><font color=#6A6A6A>게시물이 없습니다.</a></td></tr><? } ?>
</table>
3) index.php 내용에 최근게시물 나타내려면,
함수를 호출하면 되겠죠.
...<td>
<?
// 최신글
$sql = " select bo_table, bo_subject from $g4[board_table] order by gr_id, bo_table ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
// 이 함수가 바로 최신글을 추출하는 역할을 합니다.
// 스킨은 입력하지 않을 경우 관리자 > 환경설정의 최신글 스킨경로를 기본 스킨으로 합니다.
// 사용방법
// latest(스킨, 게시판아이디, 출력라인, 글자수);
echo latest("", $row['bo_table'], 12, 70, "4,25");
echo "<p>\n";
}
?>
</td>...
// 최신글 추출
function latest($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
{
global $g4;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/basic";
$list = array();
$sql = " select * from $g4[board_table] where bo_table = '$bo_table'";
$board = sql_fetch($sql);
$tmp_write_table = $g4['write_prefix'] . $bo_table; // 게시판 테이블 전체이름
//$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_id desc limit 0, $rows ";
// 위의 코드 보다 속도가 빠름
$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_num limit 0, $rows ";
//explain($sql);
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++)
$list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
2) skin/latest/***/latest.skin.php 파일
*** skin을 적용한 게시판에서 최근게시물 관련 정보를 추출, 화면 처리 합니다.
<table width=100% cellpadding=0 cellspacing=0>
<colgroup width=14>
<colgroup>
<colgroup width=37>
<colgroup width=14>
<tr>
<td><img src='<?=$latest_skin_path?>/img/latest_t01.gif'></td>
<td background='<?=$latest_skin_path?>/img/bg_latest.gif'> <strong><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><?=$board[bo_subject]?></a></strong></td>
<td background='<?=$latest_skin_path?>/img/bg_latest.gif'><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>'><img src='<?=$latest_skin_path?>/img/more.gif' border=0></a></td>
<td><img src='<?=$latest_skin_path?>/img/latest_t02.gif'></td>
</tr>
<? for ($i=0; $i<count($list); $i++) { ?>
<tr>
<td colspan=4 align=center>
<table width=95%>
<tr>
<td height=25><img src='<?=$latest_skin_path?>/img/latest_icon.gif' align=absmiddle>
<?
echo $list[$i]['icon_reply'] . " ";
echo "<a href='{$list[$i]['href']}'>";
if ($list[$i]['is_notice'])
echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list[$i]['subject']}</strong></font>";
else
echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list[$i]['subject']}</font>";
echo "</a>";
if ($list[$i]['comment_cnt'])
echo " <a href=\"{$list[$i]['comment_href']}\"><span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list[$i]['comment_cnt']}</span></a>";
// if ($list[$i]['link']['count']) { echo "[{$list[$i]['link']['count']}]"; }
// if ($list[$i]['file']['count']) { echo "<{$list[$i]['file']['count']}>"; }
echo " " . $list[$i]['icon_new'];
echo " " . $list[$i]['icon_file'];
echo " " . $list[$i]['icon_link'];
echo " " . $list[$i]['icon_hot'];
echo " " . $list[$i]['icon_secret'];
?></td></tr>
<tr><td bgcolor=#EBEBEB height=1></td></tr>
</table></td>
</tr>
<? } ?>
<? if (count($list) == 0) { ?><tr><td colspan=4 align=center height=50><font color=#6A6A6A>게시물이 없습니다.</a></td></tr><? } ?>
</table>
3) index.php 내용에 최근게시물 나타내려면,
함수를 호출하면 되겠죠.
...<td>
<?
// 최신글
$sql = " select bo_table, bo_subject from $g4[board_table] order by gr_id, bo_table ";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i++) {
// 이 함수가 바로 최신글을 추출하는 역할을 합니다.
// 스킨은 입력하지 않을 경우 관리자 > 환경설정의 최신글 스킨경로를 기본 스킨으로 합니다.
// 사용방법
// latest(스킨, 게시판아이디, 출력라인, 글자수);
echo latest("", $row['bo_table'], 12, 70, "4,25");
echo "<p>\n";
}
?>
</td>...