2026 년 4 월

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

 
그누스킨 그누소스 소스변경 소스문법 홈준비 기타
 
작성일 : 11-09-12 12:59
[그누소스] 카테고리별 최신글 뽑아오기
 글쓴이 : Yemam (211.♡.235.69)
조회 : 6,209  

if (!defined('_GNUBOARD_')) exit;

// 최신글 추출
function latest($skin_dir="", $bo_table, $rows=10, $subject_len=40, $options="")
{
     global $g4;
    
     $a = explode("|", $bo_table);
     $bo_table = $a[0];
     $ca_name = $a[1];
    
     $latest_skin_path = "$g4[path]/skin/latest";
     $latest_skin_path .= $skin_dir ? "/$skin_dir" : "/basic";
    
     $sql = " select * from $g4[board_table] where bo_table = '$bo_table'";
     $board = sql_fetch($sql);
    
     $tmp_write_table = $g4['write_prefix'].$bo_table;
     $where = "where wr_is_comment=0";
     if ($ca_name) $where .= " and ca_name='$ca_name'";
     $sql = " select * from $tmp_write_table $where order by wr_num limit 0, $rows ";
    
     $result = sql_query($sql);
     $list = array();
     for ($i=0; $row = sql_fetch_array($result); $i++)
          $list[$i] = get_list($row, $board, $latest_skin_path, $subject_len);
    
     ob_start();
     include "$latest_skin_path/latest.skin.php";
     $content = ob_get_contents();
     ob_end_clean();
    
     return $content;
}

/* 사용 예
include("$g4[path]/lib/latest.lib.php");
echo latest("basic", "community|freeboard", 10); // 보드명|카테고리명
// echo latest("basic", "community", 10); // 카테고리 없이 사용

카테고리별 최신글 요청이 많아서 따로 함수를 만들어 썼었는데
latest.lib.php를 조금만 수정하면 쉽게 구현이 가능하더군요.
위 소스를 lib/latest.lib.php에 덮어씌우면 됩니다.

그누 소스를 건들기 찜찜하신 분들은
lib/latest2.lib.php로 저장하고
latest.lib.php대신 latest2.lib.php를 인클루드 해서 쓰면 되겠죠.

include("$g4[path]/lib/latest2.lib.php");
echo latest("basic", "community|freeboard", 10);
*/

[이 게시물은 morning님에 의해 2012-02-26 10:49:39 그누소스에서 이동 됨]

Yemam 11-09-15 14:31
 211.♡.235.69  
$sqlb = " select bo_subject, bo_table, znbo_leftmenu, znbo_leftmenulink, znbo_leftmenutarget, znbo_outurl, bo_new from $g4[board_table] where (gr_id = '$row[gr_id]') and znbo_leftmenu = '1' order by bo_order_search, bo_table";
    $resultb = sql_query($sqlb);
    for ($j=0; $rowb=sql_fetch_array($resultb); $j++) {
    //new icon
    $new_time = date("Y-m-d H:i:s", $g4['server_time'] - ($rowb[bo_new] * 3600));
    $sqlc = " select count(wr_datetime) as cnt from {$g4[write_prefix]}{$rowb[bo_table]} where wr_datetime >= '$new_time' ";
    $row = sql_fetch($sqlc);
    if ($row[cnt] > 0)
    $new = "<img src='$g4[path]/img/icon_new.gif' border='0' style='vertical-align:middle;' alt=''>";

이렇게 해서 new버튼을 뽑고 있습니다.
$row[cnt] 이놈이 카운트 값이 되겠습니다..
 
 

Total 62
번호 제   목 글쓴이 날짜 조회
62 [그누소스] 점선긋는 방법 Morning 08-07 6126
61 [그누소스] 그누보드 모바일폴더 설정 Morning 07-19 8676
60 [그누소스] 검색에서 (1) Morning 01-28 6346
59 [그누소스] 하나의 계정에 그누보드를 2개이상 연동하는 … Morning 09-13 6574
58 [그누소스] 댓글에 그림넣기 Morning 07-12 6608
57 [그누소스] 보드필드에 강제로 입력하기 Morning 03-21 5861
56 [그누소스] 추가필드 간단하게 만들기 Morning 03-21 4793
55 [그누소스] 그누보드 path (12) Morning 03-01 15003
54 [그누소스] 페이지에 최신글이 아닌 게시판을 바로 출력… Morning 02-27 4579
53 [그누소스] 헤드와 테일없이 프린트출력방법과 본문전환… Yemam 04-09 4632
52 [그누소스] 그누보드처럼 IP 를 ♡ 로 숨기기 (3) Yemam 09-12 4933
51 [그누소스] if($w=="u"){ Yemam 09-12 4779
50 [그누소스] 게시판 카테고리 셀렉트 박스 없이 뿌려주기 … Yemam 09-12 5748
49 [그누소스] 카테고리별 최신글 뽑아오기 (1) Yemam 09-12 6210
48 [그누소스] 카테고리에 CheckBox 로 다수의 항목 입력가능… Yemam 09-12 6513
 1  2  3  4  5  

Therefore, holy brothers, who share in the heavenly calling,
fix your thoughts on Jesus, the apostle and high priest whom we confess.
Let us fix our eyes on Jesus, the author and perfecter of our faith,
who for the joy set before him endured the cross, scorning its shame,
and sat down at the right hand of the throne of God