최신글 latest를 css만 바꿔서 notice로 따로 쓰려고 하는데 에러가 나오네요
그누보드를 이용해서 홈페이지를 만들고 있는 초보프로그래머 입니다.
제가 최신글 latest 를 css만 변경해서 사용하려고 하는데요. 그래서 latest를 notice로 바꾸려고 합니다.
latest 부분을 notice 로 바꾸기만 하면 될 줄 알았는데 안되네요.ㅠㅠ
제가 어떻게
그누보드 lib폴더에 있는 latest.lib.php를 똑같이 복사해서 latest부분을 전부 notice로 바꾸고 notice.lib.php로 만들고
skin폴더에 있는 latest폴더 역쉬 똑같이 복사해서 notice폴더로 바꾸고 안에 있는 latest.skin.php 를 똑같이 복사해서 latest부분을 전부 notice로 바꾸고
notice.skin.php 로 바꿔서 <?php echo notice("basic", menu05_01, 5, 40); ?> 이렇게 사용하려고 하는데요. 이런 에러가 뜨네요.
Fatal error: Call to undefined function notice() inC:\APM_Setup\htdocs\clien\index.php on line 26
제가 무언가 실수를 한거 같은데 혹시 아시는 분들 있으시면 답변주시면 감사하겠습니다.
밑에 제가 바꾼 notice.lib.php와 notice.skin.php 를 올립니다.
notice.lib.php
<?phpif (!defined('_GNUBOARD_')) exit; // 최신글 추출// $cache_time 캐시 갱신시간function notice($skin_dir='', $bo_table, $rows=10, $subject_len=40, $cache_time=1, $options=''){ global $g5; //static $css = array(); if (!$skin_dir) $skin_dir = 'basic'; if(G5_IS_MOBILE) { $notice_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/notice/'.$skin_dir; $notice_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/notice/'.$skin_dir; } else { $notice_skin_path = G5_SKIN_PATH.'/notice/'.$skin_dir; $notice_skin_url = G5_SKIN_URL.'/notice/'.$skin_dir; } $cache_fwrite = false; if(G5_USE_CACHE) { $cache_file = G5_DATA_PATH."/cache/latest-{$bo_table}-{$skin_dir}-{$rows}-{$subject_len}.php"; if(!file_exists($cache_file)) { $cache_fwrite = true; } else { if($cache_time > 0) { $filetime = filemtime($cache_file); if($filetime && $filetime < (G5_SERVER_TIME - 3600 * $cache_time)) { @unlink($cache_file); $cache_fwrite = true; } } if(!$cache_fwrite) include($cache_file); } } if(!G5_USE_CACHE || $cache_fwrite) { $list = array(); $sql = " select * from {$g5['board_table']} where bo_table = '{$bo_table}' "; $board = sql_fetch($sql); $bo_subject = get_text($board['bo_subject']); $tmp_write_table = $g5['write_prefix'] . $bo_table; // 게시판 테이블 전체이름 $sql = " select * from {$tmp_write_table} where wr_is_comment = 0 order by wr_num limit 0, {$rows} "; $result = sql_query($sql); for ($i=0; $row = sql_fetch_array($result); $i++) { $list[$i] = get_list($row, $board, $latest_skin_url, $subject_len); } if($cache_fwrite) { $handle = fopen($cache_file, 'w'); $cache_content = "<?php\nif (!defined('_GNUBOARD_')) exit;\n\$bo_subject='".$bo_subject."';\n\$list=".var_export($list, true)."?>"; fwrite($handle, $cache_content); fclose($handle); } } /* // 같은 스킨은 .css 를 한번만 호출한다. if (!in_array($skin_dir, $css) && is_file($latest_skin_path.'/style.css')) { echo '<link rel="stylesheet" href="'.$latest_skin_url.'/style.css">'; $css[] = $skin_dir; } */ ob_start(); include $notice_skin_path.'/notice.skin.php'; $content = ob_get_contents(); ob_end_clean(); return $content;}?>
notice.skin.php
<?phpif (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가 // add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨add_stylesheet('<link rel="stylesheet" href="'.$notice_skin_url.'/style.css">', 0);?> <!-- <?php echo $bo_subject; ?> 최신글 시작 { --><div class="lt"> <strong class="lt_title"><a href="<?php echo G5_BBS_URL ?>/board.php?bo_table=<?php echo $bo_table ?>"><?php echo $bo_subject; ?></a></strong> <ul> <?php for ($i=0; $i<count($list); $i++) { ?> <li> <?php //echo $list[$i]['icon_reply']." "; echo "<a href=\"".$list[$i]['href']."\">"; if ($list[$i]['is_notice']) echo "<strong>".$list[$i]['subject']."</strong>"; else echo $list[$i]['subject']; if ($list[$i]['comment_cnt']) echo $list[$i]['comment_cnt']; echo "</a>"; // if ($list[$i]['link']['count']) { echo "[{$list[$i]['link']['count']}]"; } // if ($list[$i]['file']['count']) { echo "<{$list[$i]['file']['count']}>"; } if (isset($list[$i]['icon_new'])) echo " " . $list[$i]['icon_new']; if (isset($list[$i]['icon_hot'])) echo " " . $list[$i]['icon_hot']; if (isset($list[$i]['icon_file'])) echo " " . $list[$i]['icon_file']; if (isset($list[$i]['icon_link'])) echo " " . $list[$i]['icon_link']; if (isset($list[$i]['icon_secret'])) echo " " . $list[$i]['icon_secret']; ?> </li> <?php } ?> <?php if (count($list) == 0) { //게시물이 없을 때 ?> <li>게시물이 없습니다.</li> <?php } ?> </ul> <div class="lt_more"><a href="<?php echo G5_BBS_URL ?>/board.php?bo_table=<?php echo $bo_table ?>"><span class="sound_only"><?php echo $bo_subject ?></span>더보기</a></div></div><!-- } <?php echo $bo_subject; ?> 최신글 끝 -->
답변 4개
첫번째로 lib 폴더에 복사한 notice.lib.php 파일이 있어야 하고
두번째로는 skin/notice 폴더가 있어야 하며
세번째로는 skin/notice/basic 폴더가 있어야 하며
네번째로는 skin/notice/basic 폴더내에 notice.skin.php 이 있어야 합니다.
끝으로 <?php echo notice("basic", 게시판명, 5, 40); ?>를 출력을 원하시는 위치에 추가 해 주면 됩니다.
latest/basic 폴더를 복사해서... 이름을 가령 'basic_notice'로 바꿉니다.
그리고 폴더 내의 'style.css' 파일의 내용을 원하는대로 수정합니다.
head.php 파일 상단에 보면
include_once(G5_LIB_PATH.'/latest.lib.php');
처럼 해당 라이브러리가 인클루드 되어 있습니다.
이것처럼 notice.lib.php 를 인클루드 시키셔야 합니다.
'is_notice' 어디서 설정하셨나요? 찾아보심이... 다 바꾸신게 아닌듯한데...
답변을 작성하려면 로그인이 필요합니다.