최신게시물 스킨에 공지만 출력되게 하고싶습니다. 정보
최신게시물 스킨에 공지만 출력되게 하고싶습니다.본문
sql이니 뭐니 하나도 모르는 상태에서 삽질할라니 머리만 아프네요..
A, B 두개의 게시판에서 공지글만 뽑아서 메인에서 출력하려 합니다.
이곳 게시판에서 이것저것 찾아봤지만 어떤걸 적용해야하는지 어떻게 적용해야하는지
도무지 알수가 없네요..
다른건 다 필요없고 그냥 '공지글'만 뽑아다가 뿌려주면 됩니다.
http://www.ican2080.com/ <-- 주소는 이곳.
A, B 두개의 게시판에서 공지글만 뽑아서 메인에서 출력하려 합니다.
이곳 게시판에서 이것저것 찾아봤지만 어떤걸 적용해야하는지 어떻게 적용해야하는지
도무지 알수가 없네요..
다른건 다 필요없고 그냥 '공지글'만 뽑아다가 뿌려주면 됩니다.
http://www.ican2080.com/ <-- 주소는 이곳.
댓글 전체

<?php echo latest_notice( 'basic', array( 'a','b','c'), 10, 50); ?>
에서 array부분엔 무엇을 넣어야 하나요?
에서 array부분엔 무엇을 넣어야 하나요?

array('A','B')
입니다.
입니다.
lib/latest_notice.php
<?php
if (!defined('_GNUBOARD_')) exit;
// 최신글 추출
function quoting(&$item1, $key) { $item1 = "'$item1'"; }
function latest_notice($skin_dir="", $bo_tables, $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";
if( !is_array( $bo_tables)) return 'A second parameter error:bo_tables should be an array.';
array_walk( $bo_tables , 'quoting');
$bo_tables_cond= implode(',', $bo_tables);
$notice_res= sql_query( "select bo_table, bo_notice from {$g4['board_table']} where bo_table in ( $bo_tables_cond ) " );
$notice_wr_id_cond=array();
$notice_bo_tables=array();
while( $row= sql_fetch_array( $notice_res)) {
$this_notice= trim($row['bo_notice']);
if( empty( $this_notice)) continue;
$notice_wr_id_cond[]= implode( ',', split("\n", $this_notice));
$notice_bo_tables[]= $row['bo_table'];
}
$sqls= array();
foreach( $notice_bo_tables as $idx => $notice_bo_table) {
$sqls[]= " select wr_id , wr_subject from {$g4['write_prefix']}$notice_bo_table where wr_id in ( {$notice_wr_id_cond[$idx]} )";
}
$list = array();
$result = sql_query( implode( ' union all ', $sqls));
for ($i=0; ($row = sql_fetch_array($result)) && $i < $rows; $i++)
$list[$i] = get_list($row, array( 'bo_table'=>$notice_bo_table), $latest_skin_path, $subject_len);
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>
요런 녀석을 생성하고 출력부분에
<?php echo latest_notice("main", array( 'icannotice','test'), "5", "32")?>
라고 해줬는데 아래와 같은 에러를 내네요..
어느부분이 문제인가요?
Fatal error: Call to undefined function: latest_notice() in /home/hosting_users/ican2080/www/bbs/main.php on line 61
<?php
if (!defined('_GNUBOARD_')) exit;
// 최신글 추출
function quoting(&$item1, $key) { $item1 = "'$item1'"; }
function latest_notice($skin_dir="", $bo_tables, $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";
if( !is_array( $bo_tables)) return 'A second parameter error:bo_tables should be an array.';
array_walk( $bo_tables , 'quoting');
$bo_tables_cond= implode(',', $bo_tables);
$notice_res= sql_query( "select bo_table, bo_notice from {$g4['board_table']} where bo_table in ( $bo_tables_cond ) " );
$notice_wr_id_cond=array();
$notice_bo_tables=array();
while( $row= sql_fetch_array( $notice_res)) {
$this_notice= trim($row['bo_notice']);
if( empty( $this_notice)) continue;
$notice_wr_id_cond[]= implode( ',', split("\n", $this_notice));
$notice_bo_tables[]= $row['bo_table'];
}
$sqls= array();
foreach( $notice_bo_tables as $idx => $notice_bo_table) {
$sqls[]= " select wr_id , wr_subject from {$g4['write_prefix']}$notice_bo_table where wr_id in ( {$notice_wr_id_cond[$idx]} )";
}
$list = array();
$result = sql_query( implode( ' union all ', $sqls));
for ($i=0; ($row = sql_fetch_array($result)) && $i < $rows; $i++)
$list[$i] = get_list($row, array( 'bo_table'=>$notice_bo_table), $latest_skin_path, $subject_len);
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
?>
요런 녀석을 생성하고 출력부분에
<?php echo latest_notice("main", array( 'icannotice','test'), "5", "32")?>
라고 해줬는데 아래와 같은 에러를 내네요..
어느부분이 문제인가요?
Fatal error: Call to undefined function: latest_notice() in /home/hosting_users/ican2080/www/bbs/main.php on line 61

http://sir.co.kr/manual/youngcart4/?man=skin.htm#latest
참고하세요.
lib/latest_notice.php
으로 파일 만드세요.
그리고 include하세요.
참고하세요.
lib/latest_notice.php
으로 파일 만드세요.
그리고 include하세요.
앞부분에 include가 있었군요..
구조에 대해 전혀 모르다보니 힘든점이 많네요..
엑스엠엘님 답변으로 겨우 해결봤습니다.
감사합니다 ^^
구조에 대해 전혀 모르다보니 힘든점이 많네요..
엑스엠엘님 답변으로 겨우 해결봤습니다.
감사합니다 ^^