[G4] 최신글 - 랜덤게시물 추출 방법 - [2006.03.19 1차 수정]
1. extend 디렉토리에 developer.lib.php을 올립니다.
2. developer.lib.php 파일 내용은 다음과 같습니다.
===================================== developer.lib.php =====================================
<?
//랜덤게시물 추출 방법
function r_latest($skin_dir="", $bo_table, $rows=10, $subject_len=40)
{
global $g4;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/basic";
$list = array();
$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 order by rand() desc limit 0, $rows ";
//explain($sql);
$result = sql_query($sql);
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;
}
?>
=============================================================================
3. 불러오고자 하는 곳에서 아래와 같이 불러옵니다.
<?=r_latest("최신글스킨명", 테이블명, 불러올갯수, 제목길이);?>
(적용예제) <?=r_latest("img", bbs, 5, 70);?>
[2006.03.19 1차 수정]
- 버전 업그레이드로 인한 랜덤이 제대로 적용 안되던것 수정
2. developer.lib.php 파일 내용은 다음과 같습니다.
===================================== developer.lib.php =====================================
<?
//랜덤게시물 추출 방법
function r_latest($skin_dir="", $bo_table, $rows=10, $subject_len=40)
{
global $g4;
if ($skin_dir)
$latest_skin_path = "$g4[path]/skin/latest/$skin_dir";
else
$latest_skin_path = "$g4[path]/skin/latest/basic";
$list = array();
$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 order by rand() desc limit 0, $rows ";
//explain($sql);
$result = sql_query($sql);
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;
}
?>
=============================================================================
3. 불러오고자 하는 곳에서 아래와 같이 불러옵니다.
<?=r_latest("최신글스킨명", 테이블명, 불러올갯수, 제목길이);?>
(적용예제) <?=r_latest("img", bbs, 5, 70);?>
[2006.03.19 1차 수정]
- 버전 업그레이드로 인한 랜덤이 제대로 적용 안되던것 수정
댓글 44개
bbking
20년 전
좋은 팁을 이제사 보네요...^^
20년 전
원하던거~~감사
morning
20년 전
저에게는 꼭 필요한 것이었는데.....
감사합니다.
감사합니다.
20년 전
까만도둑님 멋지십니다. ^^b
20년 전
와우~*
'까만도둑'님께서도 정말 숨가쁘게 달려 가시네요^^;
목록보기에 관한 부분은 나름대로 관리자님의 '태클(?!)'이라 여겨집니다만...
g4가 정말로 안정궤도에 오르면 구현되지 않을까 조심스레 짐작해 봅니다^^;
'까만도둑'님께서도 정말 숨가쁘게 달려 가시네요^^;
목록보기에 관한 부분은 나름대로 관리자님의 '태클(?!)'이라 여겨집니다만...
g4가 정말로 안정궤도에 오르면 구현되지 않을까 조심스레 짐작해 봅니다^^;
20년 전
팁텍게시판에 목록보기는 언제쯤 될까나........
20년 전
한 동안 웹을 접하지 못 하여 홈피 하나 만들려고 다시 잡으니
어리둥절 한데 많은 도움이 되고있습니다..
감사합니다 까만도독님!!
어리둥절 한데 많은 도움이 되고있습니다..
감사합니다 까만도독님!!
SHINIYA
20년 전
오류 뜨는데요 ㅡㅡ"
Warning: Cannot modify header information - headers already sent by (output started at d:\program\apm_setup\htdocs\gnuboard4\extend\developer.lib.php:36) in d:\program\apm_setup\htdocs\gnuboard4\head.sub.php on line 44
Warning: Cannot modify header information - headers already sent by (output started at d:\program\apm_setup\htdocs\gnuboard4\extend\developer.lib.php:36) in d:\program\apm_setup\htdocs\gnuboard4\head.sub.php on line 46
Warning: Cannot modify header information - headers already sent by (output started at d:\program\apm_setup\htdocs\gnuboard4\extend\developer.lib.php:36) in d:\program\apm_setup\htdocs\gnuboard4\head.sub.php on line 47
Warning: Cannot modify header information - headers already sent by (output started at d:\program\apm_setup\htdocs\gnuboard4\extend\developer.lib.php:36) in d:\program\apm_setup\htdocs\gnuboard4\head.sub.php on line 48
Warning: Cannot modify header information - headers already sent by (output started at d:\program\apm_setup\htdocs\gnuboard4\extend\developer.lib.php:36) in d:\program\apm_setup\htdocs\gnuboard4\head.sub.php on line 49
Warning: Cannot modify header information - headers already sent by (output started at d:\program\apm_setup\htdocs\gnuboard4\extend\developer.lib.php:36) in d:\program\apm_setup\htdocs\gnuboard4\head.sub.php on line 50
Warning: Cannot modify header information - headers already sent by (output started at d:\program\apm_setup\htdocs\gnuboard4\extend\developer.lib.php:36) in d:\program\apm_setup\htdocs\gnuboard4\head.sub.php on line 44
Warning: Cannot modify header information - headers already sent by (output started at d:\program\apm_setup\htdocs\gnuboard4\extend\developer.lib.php:36) in d:\program\apm_setup\htdocs\gnuboard4\head.sub.php on line 46
Warning: Cannot modify header information - headers already sent by (output started at d:\program\apm_setup\htdocs\gnuboard4\extend\developer.lib.php:36) in d:\program\apm_setup\htdocs\gnuboard4\head.sub.php on line 47
Warning: Cannot modify header information - headers already sent by (output started at d:\program\apm_setup\htdocs\gnuboard4\extend\developer.lib.php:36) in d:\program\apm_setup\htdocs\gnuboard4\head.sub.php on line 48
Warning: Cannot modify header information - headers already sent by (output started at d:\program\apm_setup\htdocs\gnuboard4\extend\developer.lib.php:36) in d:\program\apm_setup\htdocs\gnuboard4\head.sub.php on line 49
Warning: Cannot modify header information - headers already sent by (output started at d:\program\apm_setup\htdocs\gnuboard4\extend\developer.lib.php:36) in d:\program\apm_setup\htdocs\gnuboard4\head.sub.php on line 50
아틸라
19년 전
그러네요, lib 파일만 올리면,,
NeoGenesis
19년 전
공백을 없애세요...
마지막 부분을
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content; } ?>
요런 식으로 하세요.
마지막 부분을
ob_start();
include "$latest_skin_path/latest.skin.php";
$content = ob_get_contents();
ob_end_clean();
return $content; } ?>
요런 식으로 하세요.
19년 전
연착 했습니다.
랜덤하게...
아주 좋습니다.
멋지고 감사합니다.
랜덤하게...
아주 좋습니다.
멋지고 감사합니다.
pontos
19년 전
아주 유용한 팁이네요. 감사 !!
pontos
19년 전
유용한 팁 감사합니다.
용된지렁이
19년 전
고맙습니다 잘사용할게요
Photofly
19년 전
좋은 팁을 이제야 보았네요....
좋은 팁 올려 주셔서 감사합니다...^^
좋은 팁 올려 주셔서 감사합니다...^^
19년 전
랜덤 굿
19년 전
전체게시판 추출은 안되나봐요 ?ㅠ_ㅠ
19년 전
좋네요 감사합니다
19년 전
진짜 감사해요!
겔러리 자료 업그레이드 압박에서 해방!^^
할~~할~~할
겔러리 자료 업그레이드 압박에서 해방!^^
할~~할~~할
19년 전
rss용
19년 전
q
18년 전
공백 없으니깐 에러 바로 없어 지는군..좋은팁감사..^^
18년 전
유용히 잘 쓸께요
zipshin
18년 전
적용이 아주 잘되고 있습니다. 감사합니다.
18년 전
정말 무엇으로 감사드려야 할지 모르겠네요.
너무 잘 쓰고 있습니다.
실력이 너무 부럽습니다.
너무 잘 쓰고 있습니다.
실력이 너무 부럽습니다.
myungyi
18년 전
감사합니다.
18년 전
감사합니다.. ^^
18년 전
감사여
18년 전
감사합니다..잘쓰겠어요..
18년 전
원하던 기능입니다.
설명대로 하니 잘 돌아가네요 감사합니다 ^^
설명대로 하니 잘 돌아가네요 감사합니다 ^^
포천초등학교
18년 전
감사합니다 스크랩 해뒀다가 꼭 써먹어야 겠네요^^
심심맨닷컴
17년 전
최신글 - 랜덤게시물 추출 방법
17년 전
감사합니다..찾던건데...^^*
17년 전
정말 감사해요~
17년 전
감사합니다~
16년 전
으..공백 없애도 오류나네...
15년 전
한번확인해보세요^-^
잘되고있는거 2010년 6월 23일까지 확인되었습니다^ㅡ^
잘되고있는거 2010년 6월 23일까지 확인되었습니다^ㅡ^
15년 전
오류없이 잘되네요..^-^
extend 폴더 사용해서 그런지...
원본에 이상이 없기때문에..
함수오류가 아니고선.... 제대로 될터인데..
현재까지 잘됩니다^ㅡ^
extend 폴더 사용해서 그런지...
원본에 이상이 없기때문에..
함수오류가 아니고선.... 제대로 될터인데..
현재까지 잘됩니다^ㅡ^
palangsae
15년 전
오늘 필요해서 찾았는데 공백지워지고 적용하니 잘 되네요.
수리수리마수리
15년 전
좋은 자료 감사합니다.
다른건 다 잘 작동하는데..
문제는 회원가입시에만 오류가 나네요.
개인정보정책동의 하고 그 다음 페이지에서 에러메시지가 뜹니다.
확인바랍니다.
다시한번 좋은 자료 주신점 감사드립니다.
다른건 다 잘 작동하는데..
문제는 회원가입시에만 오류가 나네요.
개인정보정책동의 하고 그 다음 페이지에서 에러메시지가 뜹니다.
확인바랍니다.
다시한번 좋은 자료 주신점 감사드립니다.
수리수리마수리
15년 전
해결했습니다.
1. extend 폴더가 아닌 lib 폴더에 넣었구요.
2. include_once("$g4[path]/lib/developer.lib.php"); - 최신글 나오는곳에 삽입
3. 기존 인클루드된 latest.lib.php 을 반드시 삭제해야 합니다.
휴..
1. extend 폴더가 아닌 lib 폴더에 넣었구요.
2. include_once("$g4[path]/lib/developer.lib.php"); - 최신글 나오는곳에 삽입
3. 기존 인클루드된 latest.lib.php 을 반드시 삭제해야 합니다.
휴..
15년 전
감사합니다^^
12년 전
좋은 정보 감사합니다~~^^
12년 전
정말 감사합니다.^^
게시판 목록
그누4 팁자료실
그누보드4와 관련된 팁을 여러분들과 함께 공유하세요.
나누면 즐거움이 커집니다.
나누면 즐거움이 커집니다.
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 3309 | 3년 전 | 1802 | ||
| 3308 | 11년 전 | 2091 | ||
| 3307 |
uPAmJ903
|
6년 전 | 4750 | |
| 3306 |
바른사나이
|
6년 전 | 3273 | |
| 3305 | 6년 전 | 12305 | ||
| 3304 | 7년 전 | 3702 | ||
| 3303 | 7년 전 | 3742 | ||
| 3302 |
지리산초보
|
7년 전 | 13596 | |
| 3301 |
sozet
|
8년 전 | 4901 | |
| 3300 |
sozet
|
8년 전 | 5971 | |
| 3299 |
sozet
|
8년 전 | 10862 | |
| 3298 | 8년 전 | 4015 | ||
| 3297 |
또치하우스
|
8년 전 | 4442 | |
| 3296 | 8년 전 | 11969 | ||
| 3295 |
또치하우스
|
8년 전 | 14984 | |
| 3294 | 8년 전 | 6024 | ||
| 3293 | 8년 전 | 5587 | ||
| 3292 |
|
9년 전 | 5316 | |
| 3291 | 9년 전 | 13677 | ||
| 3290 | 9년 전 | 5050 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기