답변 2개
채택된 답변
+20 포인트
9년 전
</p><p>//./lib/latest/lib.php</p><p>// 최신글 추출</p><p>// $cache_time 캐시 갱신시간</p><p>// 이것보다 구체적으로 알려드리면.. 아예 만들어드리는거와 같습니다... 좀 공부를 하시고 하셔야..</p><p>// [여기변경]이 함수이름입니다. 이 전체 부분을 복사해서 하단에 추가를 해줍니다. 그리고 변경을합니다.</p><p>// 제일 하단쯤에 주석처리해둔 쿼리문이 최신글을 가져오는 쿼리입니다. 그 부분을</p><p>// 랜덤으로 가져오는 쿼리로 변경을 해주셔야합니다.</p><p>// 그리고 <span style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"><?php echo <span style="color: rgb(255, 0, 0);">여기변경</span>("side_latest_main", "job, 5, 15, 6); //(스킨명, 게시판명, 출력갯수, 제목길이, wr) ?></span></p><p><span style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">// 위 부분에서 latest를 </span><span style="color: rgb(255, 0, 0); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">여기변경으</span><span style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">로 변경해주시면됩니다.</span></p><p>function <span style="color: rgb(255, 0, 0);">여기변경</span>($skin_dir='', $bo_table, $rows=10, $subject_len=40, $cache_time=1, $options='')</p><p>{</p><p> global $g5;</p><p> </p><p> if (!$skin_dir) $skin_dir = 'basic';</p><p> </p><p> if(preg_match('#^theme/(.+)$#', $skin_dir, $match)) {</p><p> if (G5_IS_MOBILE) {</p><p> $latest_skin_path = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];</p><p> if(!is_dir($latest_skin_path))</p><p> $latest_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];</p><p> $latest_skin_url = str_replace(G5_PATH, G5_URL, $latest_skin_path);</p><p> } else {</p><p> $latest_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];</p><p> $latest_skin_url = str_replace(G5_PATH, G5_URL, $latest_skin_path);</p><p> }</p><p> $skin_dir = $match[1];</p><p> } else {</p><p> if(G5_IS_MOBILE) {</p><p> $latest_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;</p><p> $latest_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;</p><p> } else {</p><p> $latest_skin_path = G5_SKIN_PATH.'/latest/'.$skin_dir;</p><p> $latest_skin_url = G5_SKIN_URL.'/latest/'.$skin_dir;</p><p> }</p><p> }</p><p> </p><p> $cache_fwrite = false;</p><p> if(G5_USE_CACHE) {</p><p> $cache_file = G5_DATA_PATH."/cache/latest-{$bo_table}-{$skin_dir}-{$rows}-{$subject_len}.php";</p><p> </p><p> if(!file_exists($cache_file)) {</p><p> $cache_fwrite = true;</p><p> } else {</p><p> if($cache_time > 0) {</p><p> $filetime = filemtime($cache_file);</p><p> if($filetime && $filetime < (G5_SERVER_TIME - 3600 * $cache_time)) {</p><p> @unlink($cache_file);</p><p> $cache_fwrite = true;</p><p> }</p><p> }</p><p> </p><p> if(!$cache_fwrite)</p><p> include($cache_file);</p><p> }</p><p> }</p><p> </p><p> if(!G5_USE_CACHE || $cache_fwrite) {</p><p> $list = array();</p><p> </p><p> $sql = " select * from {$g5['board_table']} where bo_table = '{$bo_table}' ";</p><p> $board = sql_fetch($sql);</p><p> $bo_subject = get_text($board['bo_subject']);</p><p> </p><p> $tmp_write_table = $g5['write_prefix'] . $bo_table; // 게시판 테이블 전체이름</p><p> <span style="color: rgb(255, 0, 0);"> $sql = " select * from {$tmp_write_table} where wr_is_comment = 0 order by wr_num limit 0, {$rows} ";//여기 쿼리 변경</span></p><p> $result = sql_query($sql);</p><p> for ($i=0; $row = sql_fetch_array($result); $i++) {</p><p> $list[$i] = get_list($row, $board, $latest_skin_url, $subject_len);</p><p> }</p><p> </p><p> if($cache_fwrite) {</p><p> $handle = fopen($cache_file, 'w');</p><p> $cache_content = "<?php\nif (!defined('_GNUBOARD_')) exit;\n\$bo_subject='".$bo_subject."';\n\$list=".var_export($list, true)."?>";</p><p> fwrite($handle, $cache_content);</p><p> fclose($handle);</p><p> }</p><p> }</p><p> </p><p> ob_start();</p><p> include $latest_skin_path.'/latest.skin.php';</p><p> $content = ob_get_contents();</p><p> ob_end_clean();</p><p> </p><p> return $content;</p><p>}</p><p>
로그인 후 평가할 수 있습니다
답변에 대한 댓글 1개
�
클립
9년 전
감사합니다~
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인