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-04-04 21:25
두개의 그룹에서 최신글뽑아오는 방법
 글쓴이 : Yemam (211.♡.235.69)
조회 : 4,004  
   http://sir.co.kr/bbs/board.php?bo_table=g4_qa&wr_id=186905 [1123]
두개의 그룹에서 최신글뽑아오는 방법

function latest_group($skin_dir="", $gr_id,$id, $rows=10, $subject_len=40, $no_table="menu1_sub0", $category="", $orderby="")
{
global $config;
global $g4;

$list = array(); $limitrows = $rows;

$sqlgroup = " select bo_table, bo_subject from $g4[board_table] where gr_id = '$gr_id' || gr_id = '$id'";

// 제거할 테이블들
if ($no_table) {
$t_flag = serialize($no_table);
if ($t_flag[0] == "a") { //Array이면
for ($ic=0; $ic<count($no_table); $ic++) {
$sqlgroup .= " and bo_table != '$no_table[$ic]' ";
}
} else if ($t_flag[0] == "s") { //String이면
$sqlgroup .= " and bo_table != '$no_table' ";
}
}

$sqlgroup .= " and bo_use_search=1 order by bo_order_search ";
$rsgroup = sql_query($sqlgroup);

if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/$config[cf_latest_skin]";

for ($j=0, $k=0; $rowgroup=sql_fetch_array($rsgroup); $j++) {
$bo_table = $rowgroup[bo_table];

// 테이블 이름구함
$sql = " select * from {$g4[board_table]} where bo_table = '$bo_table'";
$board = sql_fetch($sql);

$tmp_write_table = $g4[write_prefix] . $bo_table; // 게시판 테이블 실제이름

// 옵션에 따라 정렬
$sql = "select * from $tmp_write_table where wr_is_comment = 0 ";
$sql .= (!$category) ? "" : " and ca_name = '$category' ";
$sql .= (!$orderby) ? "  order by wr_id desc " : "  order by $orderby desc, wr_id desc ";
$sql .= " limit $limitrows";

$result = sql_query($sql);

for ($i=0; $row = sql_fetch_array($result); $i++, $k++) {

if(!$orderby) $op_list[$k] = $row[wr_datetime];
else  {
$op_list[$k] = is_string($row[$orderby]) ? sprintf("%-256s", $row[$orderby]) : sprintf("%016d", $row[$orderby]);
$op_list[$k] .= $row[wr_datetime];
}

$list[$k] = get_list($row, $board, $latest_skin_path, $subject_len);

$list[$k][bo_table] = $board[bo_table];
$list[$k][bo_subject] = $board[bo_subject];

$list[$k][bo_wr_subject] = cut_str($board[bo_subject] . $list[$k][wr_subject], $subject_len);
}
}
if($k>0) array_multisort($op_list, SORT_DESC, $list);
if($k>$rows) array_splice($list, $rows);

ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content;
}
/// 함수 정의 끝

echo latest_group("basic", "01","02", 10, 50);
[이 게시물은 morning님에 의해 2012-02-26 10:55:04 그누소스에서 이동 됨]

 
 

Total 167
번호 제   목 글쓴이 날짜 조회
137 여분필드 wr_x 사용하는 여러가지 방법 Yemam 04-06 3203
136 여분필드 셀렉트 필수입력 Yemam 04-06 4140
135 필드추가를 간편하게 하는 방법 Yemam 04-05 5762
134 두개의 그룹에서 최신글뽑아오는 방법 Yemam 04-04 4005
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