그누보드 사용초보입니다. 프로그램도 잘모르는 초보라 팁을 보고따라해보는데 잘안되서 도움을 청합니다.
gnu3안에 들어있는 index.php파일에서 자동으로 최신글 불러오는것 말구요. gnu3폴더 밖에 있는 index.php파일에 특정 게시판의 최신글만 불러오려고 하는데요..
http://www.sir.co.kr/bbs/tb.php/g3_tiptech/6292 <--- 올려주신거 보고 했는데 저는 안되네요.
초보라서 너무 답답합니다~. 조업좀 부탁드립니다.
외부index.php파일에는
<?PHP
// 이 상수가 정의되지 않으면 각각의 개별 페이지는 별도로 실행될 수 없음
define("_GNUBOARD_", TRUE);
// gnu3 디렉토리에 설치 되어있다고 가정
include './gnu3/config.php';
// gnu3 디렉토리 내의 lib 디렉토리를 지정
$tmp = dir("./gnu3/lib");
while ($entry = $tmp->read()) {
// 3.24 수정
if ($entry{0} == ".") continue; // 첫문자가 "."이면 무시한다
include "./gnu3/lib/" . $entry;
}
// DB연결을 위해 dbconfig.php를 인클루드 시킴
include "./gnu3/dbconfig.php";
// DB연결자
$connect = @mysql_connect($cfg[mysql_host], $cfg[mysql_user], $cfg[mysql_pass]);
$select_db = @mysql_select_db($cfg[mysql_db], $connect);
?>
<!-- 최신글 추출 -->
<?latest_new('basic', 'news', 5, 50, 1); ?>
<!-- 최신글 추출 -->
라고 써주고
gnu3/lib/latest.lib.php파일을
<?
if (defined(__FILE__)) return;
define(__FILE__, TRUE);
//==============================================================================
// 최신글 관련 함수
//==============================================================================
// 최신글 추출
function latest_new($skin_dir='', $bo_table, $rows=5, $len=40, $dir_type=0)
{
global $latest_skin, $cfg;
$tmp_latest_skin = $latest_skin;
// 스킨디렉토리값이 넘어왔다면
if ($skin_dir) {
if ($dir_type == 0) { // 불러오는 디렉토리가 bbs 안일때
$latest_skin = "./skin/latest/$skin_dir";
}else { // 불러오는 디렉토리가 최상위 디렉토리일때
$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;
if ($dir_type == 0) { // 불러오는 디렉토리가 bbs 안일때
$list[$i][href] = "./?doc=board.php&bo_table=$bo_table&wr_id=$row[wr_id]";
}else { // 불러오는 디렉토리가 최상위 디렉토리일때
$list[$i][href] = "./bbs/?doc=board.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][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])) {
if ($dir_type == 0) { // 불러오는 디렉토리가 bbs 안일때
$list[$i]["file_image".$k] = "./data/file/$bo_table/" . $row["wr_file".$k];
}else { // 불러오는 디렉토리가 최상위 디렉토리일때
$list[$i]["file_image".$k] = "./bbs/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)));
if ($dir_type == 0) { // 불러오는 디렉토리가 bbs 안일때
$link[$i]["link_href".$k] = "./?doc=link.php&$qstr&wr_id=$row[wr_id]&index=$k";
}else { // 불러오는 디렉토리가 최상위 디렉토리일때
$link[$i]["link_href".$k] = "./bbs/?doc=link.php&$qstr&wr_id=$row[wr_id]&index=$k";
}
}
}
}
mysql_free_result($result);
include "$latest_skin/latest.skin.php";
$latest_skin = $tmp_latest_skin;
}
?>
로 고쳐서 테스트 해보니
Warning: latest_new(/latest.skin.php): failed to open stream: No such file or directory in /home/hosting_users/gms01/www/gnu3/lib/latest.lib.php on line 85
Warning: latest_new(/latest.skin.php): failed to open stream: No such file or directory in /home/hosting_users/gms01/www/gnu3/lib/latest.lib.php on line 85
Warning: latest_new(): Failed opening '/latest.skin.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/hosting_users/gms01/www/gnu3/lib/latest.lib.php on line 85
라는 에러메세지가 뜨는데 어떤부분을 고쳐야 하는지 조언 좀 부탁드립니다.
gnu3안에 들어있는 index.php파일에서 자동으로 최신글 불러오는것 말구요. gnu3폴더 밖에 있는 index.php파일에 특정 게시판의 최신글만 불러오려고 하는데요..
http://www.sir.co.kr/bbs/tb.php/g3_tiptech/6292 <--- 올려주신거 보고 했는데 저는 안되네요.
초보라서 너무 답답합니다~. 조업좀 부탁드립니다.
외부index.php파일에는
<?PHP
// 이 상수가 정의되지 않으면 각각의 개별 페이지는 별도로 실행될 수 없음
define("_GNUBOARD_", TRUE);
// gnu3 디렉토리에 설치 되어있다고 가정
include './gnu3/config.php';
// gnu3 디렉토리 내의 lib 디렉토리를 지정
$tmp = dir("./gnu3/lib");
while ($entry = $tmp->read()) {
// 3.24 수정
if ($entry{0} == ".") continue; // 첫문자가 "."이면 무시한다
include "./gnu3/lib/" . $entry;
}
// DB연결을 위해 dbconfig.php를 인클루드 시킴
include "./gnu3/dbconfig.php";
// DB연결자
$connect = @mysql_connect($cfg[mysql_host], $cfg[mysql_user], $cfg[mysql_pass]);
$select_db = @mysql_select_db($cfg[mysql_db], $connect);
?>
<!-- 최신글 추출 -->
<?latest_new('basic', 'news', 5, 50, 1); ?>
<!-- 최신글 추출 -->
라고 써주고
gnu3/lib/latest.lib.php파일을
<?
if (defined(__FILE__)) return;
define(__FILE__, TRUE);
//==============================================================================
// 최신글 관련 함수
//==============================================================================
// 최신글 추출
function latest_new($skin_dir='', $bo_table, $rows=5, $len=40, $dir_type=0)
{
global $latest_skin, $cfg;
$tmp_latest_skin = $latest_skin;
// 스킨디렉토리값이 넘어왔다면
if ($skin_dir) {
if ($dir_type == 0) { // 불러오는 디렉토리가 bbs 안일때
$latest_skin = "./skin/latest/$skin_dir";
}else { // 불러오는 디렉토리가 최상위 디렉토리일때
$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;
if ($dir_type == 0) { // 불러오는 디렉토리가 bbs 안일때
$list[$i][href] = "./?doc=board.php&bo_table=$bo_table&wr_id=$row[wr_id]";
}else { // 불러오는 디렉토리가 최상위 디렉토리일때
$list[$i][href] = "./bbs/?doc=board.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][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])) {
if ($dir_type == 0) { // 불러오는 디렉토리가 bbs 안일때
$list[$i]["file_image".$k] = "./data/file/$bo_table/" . $row["wr_file".$k];
}else { // 불러오는 디렉토리가 최상위 디렉토리일때
$list[$i]["file_image".$k] = "./bbs/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)));
if ($dir_type == 0) { // 불러오는 디렉토리가 bbs 안일때
$link[$i]["link_href".$k] = "./?doc=link.php&$qstr&wr_id=$row[wr_id]&index=$k";
}else { // 불러오는 디렉토리가 최상위 디렉토리일때
$link[$i]["link_href".$k] = "./bbs/?doc=link.php&$qstr&wr_id=$row[wr_id]&index=$k";
}
}
}
}
mysql_free_result($result);
include "$latest_skin/latest.skin.php";
$latest_skin = $tmp_latest_skin;
}
?>
로 고쳐서 테스트 해보니
Warning: latest_new(/latest.skin.php): failed to open stream: No such file or directory in /home/hosting_users/gms01/www/gnu3/lib/latest.lib.php on line 85
Warning: latest_new(/latest.skin.php): failed to open stream: No such file or directory in /home/hosting_users/gms01/www/gnu3/lib/latest.lib.php on line 85
Warning: latest_new(): Failed opening '/latest.skin.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/hosting_users/gms01/www/gnu3/lib/latest.lib.php on line 85
라는 에러메세지가 뜨는데 어떤부분을 고쳐야 하는지 조언 좀 부탁드립니다.
|
댓글을 작성하시려면 로그인이 필요합니다.
댓글 4개
if ($skin_dir) {
if ($dir_type == 0) { // 불러오는 디렉토리가 bbs 안일때
$latest_skin = "./skin/latest/$skin_dir";
}else { // 불러오는 디렉토리가 최상위 디렉토리일때
$latest_skin = "./bbs/skin/latest/$skin_dir";
}
}
이 부분이 잘못 된것 같습니다. 이것을 이렇게 수정하세요...
// 스킨디렉토리값이 넘어왔다면
if ($skin_dir) {
if ($dir_type == 0) { // 불러오는 디렉토리가 bbs 안일때
$latest_skin = "./skin/latest/$skin_dir";
}else { // 불러오는 디렉토리가 최상위 디렉토리일때
$latest_skin = "./gnu3/bbs/skin/latest/$skin_dir";
}
}
그누보드 최신글 넣기 넘 어렵네요....
아무것도 모르는 상태에서 고수님들 tip보며 따라하는데
잘 안되요....제가 뭘잘못했는지 모르겠어요....
@@@@
우선 도메인주소/index.php 화일에 아래와 같이 넣은후 맨아래
최신글 스킨과 테이블명만 바꾸어 넣었습니다.
~…
이게 뭔 뜻예요?
위에처럼 경로랑 모두 맞춰봤는데 요렇게 떠버리는군요 ..아아...