그누3 이용자인데요 정보
그누3 이용자인데요본문
그누3 이용자인데요
최신글 추출할 때
특정한 것만 가능한가요..?
예를 들면, 글쓸 때 뭐 체크박스 같은걸로 표시를 해서
그 표시 된것들만 추출하는 그런식으로요.....
고수님들?????????????????????????????????????
댓글 전체
특별한건 없습니다.그냥
여분 필드 wr_1를 체크 값을 통해 기존의 정렬방식을 그되로 유지되게 하고 최근글 function를 약간 고치시면 됩니다.
wr_1 값이 1인 경우 뽑아오기 글정렬은 기존 방식되로 뽑아옴
latest_check("test","test",4,10); <== 호출명만 다르고 기존과 동일처리
// 최신글 추출
function latest_check($skin_dir='', $bo_table, $rows=10, $len=40)
{
global $latest_skin, $cfg;
$tmp_latest_skin = $latest_skin;
// 스킨디렉토리값이 넘어왔다면
if ($skin_dir) {
$latest_skin = "./bbs/skin/latest/$skin_dir";
}
$sql = " select * from $cfg[table_board] where bo_table = '$bo_table' ";
$bo = sql_fetch($sql);
$bo_subject = $bo[bo_subject];
$sql = " select *
from {$cfg[write_table_prefix]}{$bo_table}
where wr_comment = 0 and wr_1='1'
order by wr_id desc limit 0, $rows ";
$result = sql_query($sql);
for ($i=0; $row = mysql_fetch_array($result); $i++) {
$list[$i] = $row;
$list[$i][href] = "./?doc=bbs/gnuboard.php&bo_table=$bo_table&wr_id=$row[wr_id]";
// 코멘트 카운트
$list[$i][commentcnt] = "";
if ($row[wr_commentcnt] > 0) {
$list[$i][commentcnt] = "($row[wr_commentcnt])";
}
$list[$i][name] = gblayer($row[mb_id], cut_str($row[wr_name],10), $row[wr_email], $row[wr_homepage]);
$list[$i][subject] = conv_subject($row[wr_subject], $len,"…");
$list[$i][content] = get_text($row[wr_content]);
$list[$i][date] = substr($row[wr_datetime],2,8);
$list[$i][icon_new] = "";
if ($row[wr_datetime] >= date("Y-m-d H:i:s", time() - $bo[bo_new] * 3600)) {
$list[$i][icon_new] = "<img src='$latest_skin/icon_new.gif' align=absmiddle> ";
}
for ($k=1; $k<=$cfg[file_count]; $k++) {
if (@preg_match($cfg[image_extension], $row["wr_file".$k])) {
$list[$i]["file_image".$k] = "./data/file/$bo_table/" . $row["wr_file".$k];
}
}
for ($k=1; $k<=$cfg[link_count]; $k++) {
if ($row["wr_link".$k]) {
$link[$i]["link".$k] = set_http(get_text(cut_str($row["wr_link".$k], 255)));
$link[$i]["link_href".$k] = "./?doc=bbs/gblink.php&$qstr&wr_id=$row[wr_id]&index=$k";
}
}
}
mysql_free_result($result);
include "$latest_skin/latest.skin.php";
$latest_skin = $tmp_latest_skin;
}
여분 필드 wr_1를 체크 값을 통해 기존의 정렬방식을 그되로 유지되게 하고 최근글 function를 약간 고치시면 됩니다.
wr_1 값이 1인 경우 뽑아오기 글정렬은 기존 방식되로 뽑아옴
latest_check("test","test",4,10); <== 호출명만 다르고 기존과 동일처리
// 최신글 추출
function latest_check($skin_dir='', $bo_table, $rows=10, $len=40)
{
global $latest_skin, $cfg;
$tmp_latest_skin = $latest_skin;
// 스킨디렉토리값이 넘어왔다면
if ($skin_dir) {
$latest_skin = "./bbs/skin/latest/$skin_dir";
}
$sql = " select * from $cfg[table_board] where bo_table = '$bo_table' ";
$bo = sql_fetch($sql);
$bo_subject = $bo[bo_subject];
$sql = " select *
from {$cfg[write_table_prefix]}{$bo_table}
where wr_comment = 0 and wr_1='1'
order by wr_id desc limit 0, $rows ";
$result = sql_query($sql);
for ($i=0; $row = mysql_fetch_array($result); $i++) {
$list[$i] = $row;
$list[$i][href] = "./?doc=bbs/gnuboard.php&bo_table=$bo_table&wr_id=$row[wr_id]";
// 코멘트 카운트
$list[$i][commentcnt] = "";
if ($row[wr_commentcnt] > 0) {
$list[$i][commentcnt] = "($row[wr_commentcnt])";
}
$list[$i][name] = gblayer($row[mb_id], cut_str($row[wr_name],10), $row[wr_email], $row[wr_homepage]);
$list[$i][subject] = conv_subject($row[wr_subject], $len,"…");
$list[$i][content] = get_text($row[wr_content]);
$list[$i][date] = substr($row[wr_datetime],2,8);
$list[$i][icon_new] = "";
if ($row[wr_datetime] >= date("Y-m-d H:i:s", time() - $bo[bo_new] * 3600)) {
$list[$i][icon_new] = "<img src='$latest_skin/icon_new.gif' align=absmiddle> ";
}
for ($k=1; $k<=$cfg[file_count]; $k++) {
if (@preg_match($cfg[image_extension], $row["wr_file".$k])) {
$list[$i]["file_image".$k] = "./data/file/$bo_table/" . $row["wr_file".$k];
}
}
for ($k=1; $k<=$cfg[link_count]; $k++) {
if ($row["wr_link".$k]) {
$link[$i]["link".$k] = set_http(get_text(cut_str($row["wr_link".$k], 255)));
$link[$i]["link_href".$k] = "./?doc=bbs/gblink.php&$qstr&wr_id=$row[wr_id]&index=$k";
}
}
}
mysql_free_result($result);
include "$latest_skin/latest.skin.php";
$latest_skin = $tmp_latest_skin;
}
답변채택은 했는데...
저에게는 넘 어렵네요.....
가능하면 쉽게 해주실 수 없나요?
저에게는 넘 어렵네요.....
가능하면 쉽게 해주실 수 없나요?
##최근글 출력 부분(main.php에다가 보통 넣죠)
latest_check("스킨명","게시판명",4,10);
## /lib/latest.lib.php에다 추가하세요
// 최신글 추출
function latest_check($skin_dir='', $bo_table, $rows=10, $len=40)
{
global $latest_skin, $cfg;
$tmp_latest_skin = $latest_skin;
~~~~~~~~~~~ 상기내용과 동일 ~~~~~~~~~~~~~
$latest_skin = $tmp_latest_skin;
}
## 스킨작업 : write.skin.php
원하시는 스킨에 체크값을 붙어 넣으세요
<input type=checkbox name='wr_1' value='1' <? if($write[wr_1] == 1){echo"checked"}?>> 메인최근글출력함
이상입니다.^^
latest_check("스킨명","게시판명",4,10);
## /lib/latest.lib.php에다 추가하세요
// 최신글 추출
function latest_check($skin_dir='', $bo_table, $rows=10, $len=40)
{
global $latest_skin, $cfg;
$tmp_latest_skin = $latest_skin;
~~~~~~~~~~~ 상기내용과 동일 ~~~~~~~~~~~~~
$latest_skin = $tmp_latest_skin;
}
## 스킨작업 : write.skin.php
원하시는 스킨에 체크값을 붙어 넣으세요
<input type=checkbox name='wr_1' value='1' <? if($write[wr_1] == 1){echo"checked"}?>> 메인최근글출력함
이상입니다.^^
고맙습니다.
한 번 해보겠습니다. ^^*
한 번 해보겠습니다. ^^*