테스트 사이트 - 개발 중인 베타 버전입니다

최근글출력에서... 채택완료

끝없는사랑 9년 전 조회 3,876
최근글 불러올때&amp;nbsp; 최근올린글이아니라&amp;nbsp; 클릭이 많이된글부터 불러오게 하려고 하는데요.<br />
<br />
어떻게해야하나요?<br />
<br />
<br />
에고 모바일에서 이미지를 넣어야만 쓰기가 완료 되네요 ㅡ..ㅡ
댓글을 작성하려면 로그인이 필요합니다.

답변 5개

채택된 답변
+20 포인트
그누위즈

lib/latest.lib.php 파일안에

추가하시면됩니다.

 

</p><p><?php</p><p>if (!defined('_GNUBOARD_')) exit;</p><p> </p><p>// 최신글 추출</p><p>// $cache_time 캐시 갱신시간</p><p>function latest_one_best($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> </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>        //$sql = " select * from {$tmp_write_table} where wr_is_comment = 0 order by wr_num limit 0, {$rows} ";</p><p>        $sql = " select * from {$tmp_write_table} where wr_is_comment = 0 order by wr_hit desc limit 0, {$rows}";        </p><p>     </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> </p><p>    $content = ob_get_contents();</p><p>    ob_end_clean();</p><p> </p><p>    return $content;</p><p>}</p><p>?></p><div>
</div><p>

 

사용방법

 

</p><p>echo latest_one_best("스킨명", 게시판명, 30, 18); </p><p>

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

wr_hit순 정렬로 하면되는데 최신글경우는 가벼운? 파일이라 조금 해보시면 능숙하게 다루실거에요~ 

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

진서기
9년 전
여기는 스킨 게시판인데요????????
로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

qa게시판으로 가셔야 하는데.... 스킨 떴나해서 괜히 두근거렸네요. ㅠ
로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인