특정 wr_id를 제외하려고 합니다. 코드로 못짜겠어요.도와주세요. 정보
특정 wr_id를 제외하려고 합니다. 코드로 못짜겠어요.도와주세요.
본문
안녕하세요.
아래는 분류 이름을 불러오는 latest 입니다.
아래 소스를 활용하여, view페이지 하단에 관련상품 리스트로 불러오려고 하는데요.
본 소스를 사용하면, 같은 분류 이름의 게시물은 불러오지만,
불러온 리스트에 자신도 포함이 되어 있어서요.
관련상품 기능으로 사용할 것이기 때문에, 자신은 이미 view페이지에 보여지니,
분류리스트에서 빼려고 합니다.
보여지는 해당 view화면의 게시물은 빼고, 분류리스트를 불러오려면 어떻게 하면 될까요?
"latest 분류리스트에,
현재 보여지는 view페이지의 wr_id와 같은 wr_id가 있으면,
그 wr_id게시물은 latest 분류리스트에서 제외한다"
이렇게 하면 될것 같은데, 이것을 코드로 못짜겠어요.ㅜㅜ
도와주세요.
<?
if (!defined('_GNUBOARD_')) exit;
function latest_cate($skin_dir="", $bo_table, $rows=10, $subject_len=40, $ca_name="")
{
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; // 게시판 테이블 전체이름
if ($ca_name)
$sql = " select * from $tmp_write_table where ca_name = '$ca_name' and wr_is_comment = 0 order by wr_num limit 0, $rows ";
else
$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_num limit 0, $rows ";
$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;
}
?>
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<table width=100% cellpadding=0 cellspacing=0>
<tr>
<td width=14><img src='<?=$latest_skin_path?>/img/latest_t01.gif'></td>
<td width='100%' background='<?=$latest_skin_path?>/img/bg_latest.gif'>
<strong><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>&sca=<?=$ca_name?>'><?=$ca_name?></a></strong>
</td>
<td width=37 background='<?=$latest_skin_path?>/img/bg_latest.gif'>
<a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>&sca=<?=$ca_name?>'><img src='<?=$latest_skin_path?>/img/more.gif' border=0></a>
</td>
<td width=14><img src='<?=$latest_skin_path?>/img/latest_t02.gif'></td>
</tr>
<? for ($i=0; $i<count($list); $i++) { ?>
<tr>
<td colspan=4 align=center>
<table width=95%>
<tr>
<td height=25>
<img src='<?=$latest_skin_path?>/img/latest_icon.gif' align=absmiddle>
<?
echo $list[$i]['icon_reply'] . " ";
echo "<a href='{$list[$i]['href']}&sca={$ca_name}'>";
if ($list[$i]['is_notice'])
echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list[$i]['subject']}</strong></font>";
else
echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list[$i]['subject']}</font>";
echo "</a>";
if ($list[$i]['comment_cnt'])
echo " <a href=\"{$list[$i]['comment_href']}&sca={$ca_name}\"><span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list[$i]['comment_cnt']}</span></a>";
echo " " . $list[$i]['icon_new'];
echo " " . $list[$i]['icon_file'];
echo " " . $list[$i]['icon_link'];
echo " " . $list[$i]['icon_hot'];
echo " " . $list[$i]['icon_secret'];
?>
</td>
</tr>
<tr><td bgcolor=#EBEBEB height=1></td></tr>
</table>
</td>
</tr>
<? } ?>
<? if (count($list) == 0) { ?><tr><td colspan=4 align=center height=50><font color=#6A6A6A>게시물이 없습니다.</a></td></tr><? } ?>
</table>
아래는 분류 이름을 불러오는 latest 입니다.
아래 소스를 활용하여, view페이지 하단에 관련상품 리스트로 불러오려고 하는데요.
본 소스를 사용하면, 같은 분류 이름의 게시물은 불러오지만,
불러온 리스트에 자신도 포함이 되어 있어서요.
관련상품 기능으로 사용할 것이기 때문에, 자신은 이미 view페이지에 보여지니,
분류리스트에서 빼려고 합니다.
보여지는 해당 view화면의 게시물은 빼고, 분류리스트를 불러오려면 어떻게 하면 될까요?
"latest 분류리스트에,
현재 보여지는 view페이지의 wr_id와 같은 wr_id가 있으면,
그 wr_id게시물은 latest 분류리스트에서 제외한다"
이렇게 하면 될것 같은데, 이것을 코드로 못짜겠어요.ㅜㅜ
도와주세요.
<?
if (!defined('_GNUBOARD_')) exit;
function latest_cate($skin_dir="", $bo_table, $rows=10, $subject_len=40, $ca_name="")
{
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; // 게시판 테이블 전체이름
if ($ca_name)
$sql = " select * from $tmp_write_table where ca_name = '$ca_name' and wr_is_comment = 0 order by wr_num limit 0, $rows ";
else
$sql = " select * from $tmp_write_table where wr_is_comment = 0 order by wr_num limit 0, $rows ";
$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;
}
?>
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
?>
<table width=100% cellpadding=0 cellspacing=0>
<tr>
<td width=14><img src='<?=$latest_skin_path?>/img/latest_t01.gif'></td>
<td width='100%' background='<?=$latest_skin_path?>/img/bg_latest.gif'>
<strong><a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>&sca=<?=$ca_name?>'><?=$ca_name?></a></strong>
</td>
<td width=37 background='<?=$latest_skin_path?>/img/bg_latest.gif'>
<a href='<?=$g4[bbs_path]?>/board.php?bo_table=<?=$bo_table?>&sca=<?=$ca_name?>'><img src='<?=$latest_skin_path?>/img/more.gif' border=0></a>
</td>
<td width=14><img src='<?=$latest_skin_path?>/img/latest_t02.gif'></td>
</tr>
<? for ($i=0; $i<count($list); $i++) { ?>
<tr>
<td colspan=4 align=center>
<table width=95%>
<tr>
<td height=25>
<img src='<?=$latest_skin_path?>/img/latest_icon.gif' align=absmiddle>
<?
echo $list[$i]['icon_reply'] . " ";
echo "<a href='{$list[$i]['href']}&sca={$ca_name}'>";
if ($list[$i]['is_notice'])
echo "<font style='font-family:돋움; font-size:9pt; color:#2C88B9;'><strong>{$list[$i]['subject']}</strong></font>";
else
echo "<font style='font-family:돋움; font-size:9pt; color:#6A6A6A;'>{$list[$i]['subject']}</font>";
echo "</a>";
if ($list[$i]['comment_cnt'])
echo " <a href=\"{$list[$i]['comment_href']}&sca={$ca_name}\"><span style='font-family:돋움; font-size:8pt; color:#9A9A9A;'>{$list[$i]['comment_cnt']}</span></a>";
echo " " . $list[$i]['icon_new'];
echo " " . $list[$i]['icon_file'];
echo " " . $list[$i]['icon_link'];
echo " " . $list[$i]['icon_hot'];
echo " " . $list[$i]['icon_secret'];
?>
</td>
</tr>
<tr><td bgcolor=#EBEBEB height=1></td></tr>
</table>
</td>
</tr>
<? } ?>
<? if (count($list) == 0) { ?><tr><td colspan=4 align=center height=50><font color=#6A6A6A>게시물이 없습니다.</a></td></tr><? } ?>
</table>
댓글 전체
$where = "";
if($_GET['wr_id']) $where = " and wr_id<>".$_GET['wr_id'];
$sql = " select * from $tmp_write_table where wr_is_comment = 0 ".$where." order by wr_num limit 0, $rows ";
이런식으로 한번 해보시죠
데이터가 많이 않을때 이렇게 하시고 많으시다면 소스로 처리 하는 방법을 권해드리고요.
if($_GET['wr_id']) $where = " and wr_id<>".$_GET['wr_id'];
$sql = " select * from $tmp_write_table where wr_is_comment = 0 ".$where." order by wr_num limit 0, $rows ";
이런식으로 한번 해보시죠
데이터가 많이 않을때 이렇게 하시고 많으시다면 소스로 처리 하는 방법을 권해드리고요.

아..찰스님 제가 잘 몰라서요.
알려주시는 코드를 어디에 붙이죠?
알려주시는 코드를 어디에 붙이죠?