특정게시판만 정렬을 다르게 하고 싶을때.. 정보
그누호환 특정게시판만 정렬을 다르게 하고 싶을때..본문
gblist.php 의 아래부분에서
// 정렬
if (!$ssort) {
$ssort = "wr_notice, wr_num, wr_reply";
$sorder = "";
}
아래에
아래와 같이 추가하여 사용합니다
if($bo_table==home_stay){//게시판이 홈스테이일경우
$ssort = "wr_datetime";//정렬은 날짜순으로
$sorder = "asc";//입력한순서부텀 desc로하면 최근 날짜순으로...
}
위와 같이 응용하여 씁니다
// 정렬
if (!$ssort) {
$ssort = "wr_notice, wr_num, wr_reply";
$sorder = "";
}
아래에
아래와 같이 추가하여 사용합니다
if($bo_table==home_stay){//게시판이 홈스테이일경우
$ssort = "wr_datetime";//정렬은 날짜순으로
$sorder = "asc";//입력한순서부텀 desc로하면 최근 날짜순으로...
}
위와 같이 응용하여 씁니다
추천
0
0
댓글 전체
만도님, 저도 감사합니다.
만도님!! 감사합니다.
if($bo_table==home_stay||$bo_table==home_stay2||$bo_table==home_stay3){//게시판이 홈스테이일경우
만도님!!!!
이글 원래의 질문에서 정렬을 다르게 하고자하는 게시판에 여러개일경우는 어떻게 해야되는가요?
이글 원래의 질문에서 정렬을 다르게 하고자하는 게시판에 여러개일경우는 어떻게 해야되는가요?
축축축.....입니다,,
아주 굳입니다...
번번히 신세를 지는군요, 감사합니니다.
언젠가는 필리핀에 가봐야 하는데.....
번번히 신세를 지는군요, 감사합니니다.
언젠가는 필리핀에 가봐야 하는데.....
적용한 후 다시 연락드리겠습니다.
아하 !!!!!
감사합니다.
감사합니다.
latest2('스킨명',게시판명,글수.제목글자수) 스키면은 또같이해도 될거 같읍니다만 안된다면 스킨명을 달리하여 올리시고 그스킨명을 ....
한게시판맘원하시면
립에서 레이티스트 함수를 복사해서
function latest2($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
order by wr_id asc 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;
}
이렇게 투로 만든다음
보여줄곳에 latest2('',게시판명,글수.제목글자수) 해보셔요...
립에서 레이티스트 함수를 복사해서
function latest2($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
order by wr_id asc 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;
}
이렇게 투로 만든다음
보여줄곳에 latest2('',게시판명,글수.제목글자수) 해보셔요...
그렇게 하면 모든 최신글에 적용되지 않나요?
특정게시판의 최신글에서만 적용하고 싶어요.
특정게시판의 최신글에서만 적용하고 싶어요.
립에서요
$sql = " select *
from {$cfg[write_table_prefix]}{$bo_table}
where wr_comment = 0
order by wr_id desc limit 0, $rows ";
order by wr_id asc limit 0, $rows ";
이렇게해보셔요...그렇지만...다른 최신글들도 함께그렇게 될거여요...
$sql = " select *
from {$cfg[write_table_prefix]}{$bo_table}
where wr_comment = 0
order by wr_id desc limit 0, $rows ";
order by wr_id asc limit 0, $rows ";
이렇게해보셔요...그렇지만...다른 최신글들도 함께그렇게 될거여요...
링크된 부분의 리스트는 정렬이 asc 로 되었습니다.
(이곳 만도님의 가르침대로..)
최신글의 정렬도 asc로 정렬되게 하고자 합니다.
(이곳 만도님의 가르침대로..)
최신글의 정렬도 asc로 정렬되게 하고자 합니다.
무슨 말씀이신지...어떻게 정렬을 원하시는데요...
http://www.sangdam.info/gnu3/?doc=bbs/gnuboard.php&bo_table=office
위 링크의 메뉴부분이 최신글입니다.
그것을 리스크와 같게하고자 합니다.
위 링크의 메뉴부분이 최신글입니다.
그것을 리스크와 같게하고자 합니다.
아래는 최신글스킨이고요....
---------------------------------
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<table width=170 cellpadding=0 cellspacing=0 align=center border=1 bordercolordark="#ECECDC" bordercolorlight="#000000">
<tr>
<td width="100%" align="left">
<table width=100% align="left">
<tr>
<td height=22 valign="middle">
<img src='<?=$latest_skin?>/female_n.gif' >
<a href='./?doc=bbs/gnuboard.php&bo_table=<?=$bo_table?>'><b><?=$bo_subject?></b></a>
</td>
</tr>
<tr>
<td align="left">
<table width=100% cellpadding=0 cellspacing=0 border=0 align="left">
<? for ($i=0; $i<count($list); $i++) { ?>
<? /* if ($i) { echo "<tr><td colspan=2 height=1 background='$latest_skin/dot_line.gif' width=7 height=7></td></tr>"; } */?>
<tr>
<td width=15 align=center><img src='<?=$latest_skin?>/icon_li.gif'></td>
<td width='' height=22> <a href='<?="./?doc=bbs/gnuboard.php&bo_table=$bo_table&wr_id={$list[$i][wr_id]}"?>'><span style='font-size:9pt;'><?=$list[$i][subject]?> </span> <span style='font-size:8pt;'><?=$list[$i][commentcnt]?></span></a> <?=$list[$i][icon_new]?></td>
</tr>
<? } ?>
<? if (count($list) == 0) { echo "<tr><td colspan=2 align=center height=50>자료가 없습니다.</td></tr>"; } ?>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
아래는 latest.lib 입니다.
------------------------
<?
if (defined(__FILE__)) return;
define(__FILE__, TRUE);
//==============================================================================
// 최신글 관련 함수
//==============================================================================
// 최신글 추출
function latest($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
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;
}
?>
---------------------------------
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<table width=170 cellpadding=0 cellspacing=0 align=center border=1 bordercolordark="#ECECDC" bordercolorlight="#000000">
<tr>
<td width="100%" align="left">
<table width=100% align="left">
<tr>
<td height=22 valign="middle">
<img src='<?=$latest_skin?>/female_n.gif' >
<a href='./?doc=bbs/gnuboard.php&bo_table=<?=$bo_table?>'><b><?=$bo_subject?></b></a>
</td>
</tr>
<tr>
<td align="left">
<table width=100% cellpadding=0 cellspacing=0 border=0 align="left">
<? for ($i=0; $i<count($list); $i++) { ?>
<? /* if ($i) { echo "<tr><td colspan=2 height=1 background='$latest_skin/dot_line.gif' width=7 height=7></td></tr>"; } */?>
<tr>
<td width=15 align=center><img src='<?=$latest_skin?>/icon_li.gif'></td>
<td width='' height=22> <a href='<?="./?doc=bbs/gnuboard.php&bo_table=$bo_table&wr_id={$list[$i][wr_id]}"?>'><span style='font-size:9pt;'><?=$list[$i][subject]?> </span> <span style='font-size:8pt;'><?=$list[$i][commentcnt]?></span></a> <?=$list[$i][icon_new]?></td>
</tr>
<? } ?>
<? if (count($list) == 0) { echo "<tr><td colspan=2 align=center height=50>자료가 없습니다.</td></tr>"; } ?>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
아래는 latest.lib 입니다.
------------------------
<?
if (defined(__FILE__)) return;
define(__FILE__, TRUE);
//==============================================================================
// 최신글 관련 함수
//==============================================================================
// 최신글 추출
function latest($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
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;
}
?>
소스를 보여주세요...최신글뽑는....
특정게시판의 최신글만 정렬을 다르게 하려면 어떻게 해야되죠?
좋은팁 감사합니다.