bbs/new.php 를 메인페이지에 첨부할 순 없나요?
본문
메인페이지에서 사이트 내 모든 게시판의 최근글이 나타나게 하고 싶은데요.
지금 bbs/new.php 이게 딱 마음에 듭니다. 어떻게 방법이 없을까요?
답변 2
latest.lib.php 관련함수 입니다. 나머지는 조금만 노력해보시면 될껍니다.
function latest_all($skin_dir="", $bo_table="", $rows=10, $subject_len=40, $options="", $page=1, $dataonly=false)
{
global $g4;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/basic";
$where = "";
$bo_subject = "전체최신글";
$bo_new = 7;
$more_link = $g4[bbs_path] ."/new.php";
$from_record = ($page-1) * $rows; // 시작 열을 구함
$list = array();
$sql = " SELECT
a.bo_table, a.wr_id, a.bn_datetime, b.bo_subject , b.bo_subject_len
from $g4[board_new_table] a, $g4[board_table] b
WHERE a.bo_table = b.bo_table and b.bo_use_search = '1' and wr_id = wr_parent and b.bo_display = 'Y' {$where}
ORDER BY bn_id DESC LIMIT $from_record, $rows ";
$result = sql_query($sql);
for ($i=0; $row = sql_fetch_array($result); $i++) {
$list[$i] = $row;
$tmp_write_table = $g4[write_prefix] . $row[bo_table];
$row2 = sql_fetch(" select wr_subject, wr_comment, wr_name, wr_option from $tmp_write_table where wr_id = '$row[wr_id]' ");
$list[$i]["bo_new"] = $bo_new;
$list[$i]["subject"] = conv_subject($row2["wr_subject"], $subject_len, "…");
// 당일인 경우 시간으로 표시함
$datetime = $row["bn_datetime"];
$datetime2 = substr($datetime,0,10);
if ($datetime2 == $g4[time_ymd])
$datetime2 = substr($datetime,11,5);
else
$datetime2 = substr($datetime,5,5);
$list[$i]["bn_datetime"] = $datetime2;
$list[$i]["bn_datetime2"] = $datetime;
$list[$i]["wr_name"] = $row2["wr_name"];
$list[$i]["wr_comment"] = $row2["wr_comment"];
$list[$i]["icon_secret"] = false;
if (strstr($row2["wr_option"], "secret"))
$list[$i]["icon_secret"] = true;
// 파일아이콘 출력만을 위한 퀴리를 작성.
$list[$i]["iconf"] = "";
$row2 = sql_fetch(" select bf_type from $g4[board_file_table] where bo_table = '". $row["bo_table"] ."' and wr_id = '". $row["wr_id"] ."' order by bf_type desc limit 1 ");
if ($row2["bf_type"] != "") {
$list[$i]["iconf"] = $row2["bf_type"];
}
}
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
웹루트의 index.php를 이름을 변경하여 백업해두시고.
bbs 폴더의 new.php 파일을 웹루트 디렉토리에 카피하셔서 index.php로 변경해보세요.
bbs 폴더의 new.php 파일을 웹루트 디렉토리에 카피하셔서 index.php로 변경해보세요.
답변을 작성하시기 전에 로그인 해주세요.