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,208  

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 167
번호 제   목 글쓴이 날짜 조회
137 여분필드 wr_x 사용하는 여러가지 방법 Yemam 04-06 3203
136 여분필드 셀렉트 필수입력 Yemam 04-06 4139
135 필드추가를 간편하게 하는 방법 Yemam 04-05 5762
134 두개의 그룹에서 최신글뽑아오는 방법 Yemam 04-04 4004
133 페이징하는 방법 Yemam 04-02 3232
132 [수정] 인기 검색어 특수 문자 제외 (2) Yemam 01-22 7484
131 [문법] 원하는 날짜에서 특정아이디의 데이타를 내… Yemam 09-16 4732
130 [문법] for($i=0,$cnt=count($list);$i<$cnt;$i++) 사용방식 Yemam 09-15 4682
129 [문법] 그룹 카테고리 Yemam 09-15 4759
128 [문법] 링크 보드 카테고리 Yemam 09-15 4592
127 [문법] 카테고리 (9) Yemam 09-15 6270
126 [그누소스] 그누보드처럼 IP 를 ♡ 로 숨기기 (3) Yemam 09-12 4933
125 [그누소스] if($w=="u"){ Yemam 09-12 4778
124 [그누소스] 게시판 카테고리 셀렉트 박스 없이 뿌려주기 … Yemam 09-12 5747
123 [그누소스] 카테고리별 최신글 뽑아오기 (1) Yemam 09-12 6209
 1  2  3  4  5  6  7  8  9  10    

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