view.skin.php
마땅한 위치에...
include_once("$board_skin_path/relation.php");
<?
if (!defined("_GNUBOARD_")) exit;
# 관련상품, 관련글 파일
# 제작일 2006-11-20
### 관련상품 관련
# 현재 보고있는 게시물 번호가 아닌것과 원글만 뽑고 판매가 종료된 제품, 그리고 관련상품에 체크된 제품만 찾아라!
# wr_is_comment = '0' 원글만 뽑고
# wr_id <> '$wr_id' 현재 페이지의 글은 제외하고
# wr_1 <> '1' 판매자가 판매를 완료한 제품은 제외하고
# wr_2 = '1' 판매자가 관련 상품이라고 체크한 제품은 출력하고
$relation_Q = " select * from $write_table where wr_is_comment = '0' and wr_id <> '$wr_id' and wr_1 <> '1' and wr_2 = '1' and ca_name = '$view[ca_name]' order by wr_datetime desc limit 4 ";
$relation = sql_query($relation_Q);
# 갯수 출력
$relation_Total = mysql_fetch_array(mysql_query("select count(wr_id) from $write_table where wr_is_comment = '0' and wr_id <> '$wr_id' and wr_1 <> '1' and wr_2 = '1' and ca_name = '$view[ca_name]' order by wr_datetime"));
$relation_count = $relation_Total[0];
$item_Count = number_format($relation_count);
$mod = 4;
$td_width = (int)(100 / $mod);
echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr><td valign=\"top\">";
echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<tr>";
echo "<td width=\"130\" height=\"35\"><img src=\"{$board_skin_pass}/img/relation_top_l.gif\"/></td>";
echo "<td background=\"{$board_skin_pass}/img/relation_top_c.gif\" align=\"right\">관련 제품이 <font color=\"red\">$item_Count</font>개 등록되어 있습니다.</td>";
echo "<td width=\"14\"><img src=\"{$board_skin_pass}/img/relation_top_r.gif\"/></td>";
echo "</tr>";
echo "</table>";
echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" style=\"border:1px solid #CDDC91;\">";
echo "<tr><td height=\"10\" colspan=\"$mod\"></td></tr>";
echo "<tr>";
for ($i=0; $row=sql_fetch_array($relation); $i++)
{
if ($i>0 && $i%$mod==0)
{
echo "</tr><tr>";
}
# 이미지
$relation_img = "$g4[path]/data/file/$bo_table/thumb/$row[wr_id]";
$relation_title = cut_str($row[wr_subject], 15);
$relation_cash = number_format($row[wr_3]).원;
echo "<td width=\"$td_width%\" valign=\"top\" align=\"center\">";
echo "<table cellspacing=\"8\" cellpadding=\"0\" style=\"border:1px solid #ddd; background-color:#f8f8f8;\">";
echo "<tr align=\"center\"><td><a href=\"$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id=$row[wr_id]\"><img src=\"$relation_img\" style=\"border:1px solid #666;\" alt=\"$row[wr_subject] - 글보기\"/></a></td></tr>";
echo "<tr><td align=\"center\"><a href=\"$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id=$row[wr_id]\">$relation_title</a></td></tr>";
echo "<tr><td align=\"center\">$relation_cash</td></tr>";
echo "</table>";
echo "</td>";
}
$cnt = $i%$mod;
if ($cnt)
{
for ($i=$cnt; $i<$mod; $i++)
{
echo "<td width=\"{$td_width}%\"> </td>";
}
}
if ($relation_count == 0)
{
echo "<td height=\"100\" colspan=\"$mod\" align=\"center\">등록되어 있는 관련 상품이 없습니다.</td>";
}
echo "</tr>";
echo "<tr><td height=\"10\" colspan=\"$mod\"></td></tr>";
echo "</table>";
echo "</td></tr></table>";
?>
이미지는 썸네일을 가져옵니다.
테스트가 시간이 부족한 관계로 버그가 있을수 있습니다.
적당히 수정해서 사용하시기 바랍니다.
디자인 부분은 알아서 수정하셔야 되겠습니다.
마땅한 위치에...
include_once("$board_skin_path/relation.php");
<?
if (!defined("_GNUBOARD_")) exit;
# 관련상품, 관련글 파일
# 제작일 2006-11-20
### 관련상품 관련
# 현재 보고있는 게시물 번호가 아닌것과 원글만 뽑고 판매가 종료된 제품, 그리고 관련상품에 체크된 제품만 찾아라!
# wr_is_comment = '0' 원글만 뽑고
# wr_id <> '$wr_id' 현재 페이지의 글은 제외하고
# wr_1 <> '1' 판매자가 판매를 완료한 제품은 제외하고
# wr_2 = '1' 판매자가 관련 상품이라고 체크한 제품은 출력하고
$relation_Q = " select * from $write_table where wr_is_comment = '0' and wr_id <> '$wr_id' and wr_1 <> '1' and wr_2 = '1' and ca_name = '$view[ca_name]' order by wr_datetime desc limit 4 ";
$relation = sql_query($relation_Q);
# 갯수 출력
$relation_Total = mysql_fetch_array(mysql_query("select count(wr_id) from $write_table where wr_is_comment = '0' and wr_id <> '$wr_id' and wr_1 <> '1' and wr_2 = '1' and ca_name = '$view[ca_name]' order by wr_datetime"));
$relation_count = $relation_Total[0];
$item_Count = number_format($relation_count);
$mod = 4;
$td_width = (int)(100 / $mod);
echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr><td valign=\"top\">";
echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<tr>";
echo "<td width=\"130\" height=\"35\"><img src=\"{$board_skin_pass}/img/relation_top_l.gif\"/></td>";
echo "<td background=\"{$board_skin_pass}/img/relation_top_c.gif\" align=\"right\">관련 제품이 <font color=\"red\">$item_Count</font>개 등록되어 있습니다.</td>";
echo "<td width=\"14\"><img src=\"{$board_skin_pass}/img/relation_top_r.gif\"/></td>";
echo "</tr>";
echo "</table>";
echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" style=\"border:1px solid #CDDC91;\">";
echo "<tr><td height=\"10\" colspan=\"$mod\"></td></tr>";
echo "<tr>";
for ($i=0; $row=sql_fetch_array($relation); $i++)
{
if ($i>0 && $i%$mod==0)
{
echo "</tr><tr>";
}
# 이미지
$relation_img = "$g4[path]/data/file/$bo_table/thumb/$row[wr_id]";
$relation_title = cut_str($row[wr_subject], 15);
$relation_cash = number_format($row[wr_3]).원;
echo "<td width=\"$td_width%\" valign=\"top\" align=\"center\">";
echo "<table cellspacing=\"8\" cellpadding=\"0\" style=\"border:1px solid #ddd; background-color:#f8f8f8;\">";
echo "<tr align=\"center\"><td><a href=\"$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id=$row[wr_id]\"><img src=\"$relation_img\" style=\"border:1px solid #666;\" alt=\"$row[wr_subject] - 글보기\"/></a></td></tr>";
echo "<tr><td align=\"center\"><a href=\"$g4[bbs_path]/board.php?bo_table=$bo_table&wr_id=$row[wr_id]\">$relation_title</a></td></tr>";
echo "<tr><td align=\"center\">$relation_cash</td></tr>";
echo "</table>";
echo "</td>";
}
$cnt = $i%$mod;
if ($cnt)
{
for ($i=$cnt; $i<$mod; $i++)
{
echo "<td width=\"{$td_width}%\"> </td>";
}
}
if ($relation_count == 0)
{
echo "<td height=\"100\" colspan=\"$mod\" align=\"center\">등록되어 있는 관련 상품이 없습니다.</td>";
}
echo "</tr>";
echo "<tr><td height=\"10\" colspan=\"$mod\"></td></tr>";
echo "</table>";
echo "</td></tr></table>";
?>
이미지는 썸네일을 가져옵니다.
테스트가 시간이 부족한 관계로 버그가 있을수 있습니다.
적당히 수정해서 사용하시기 바랍니다.
디자인 부분은 알아서 수정하셔야 되겠습니다.
첨부파일
댓글을 작성하시려면 로그인이 필요합니다.
댓글 5개
욕이나 먹지 않을런지 모르겠습니다.
그나저나 시간도 늦었는데 안주무세요?
ㅎㅎㅎ........