영카트 [YC4] 사용후기 전체모음
페이지 정보
본문
제품마다 입력된 구매후기를 한페이지에 모아서 보여줍니다.
제목누르면 아래에 해당후기 내용이 보입니다.
shop/itemps.all3.php 파일을 생성
<?
include_once("./_common.php");
$g4[title] = "사용후기모음";
include_once("./_head.php");
$sql_search = " where 1 ";
if ($search != "") {
if ($sel_field != "") {
$sql_search .= " and $sel_field like '%$search%' ";
}
}
if ($sel_ca_id != "") {
$sql_search .= " and ca_id like '$sel_ca_id%' ";
}
if ($sel_field == "") $sel_field = "it_name";
if (!$sort1) $sort1 = "is_id";
if (!$sort2) $sort2 = "desc";
$sql_common = " from $g4[yc4_item_ps_table] a
left join $g4[yc4_item_table] b on (a.it_id = b.it_id)
left join $g4[member_table] c on (a.mb_id = c.mb_id) ";
$sql_common .= $sql_search;
// 테이블의 전체 레코드수만 얻음
$sql = " select count(*) as cnt " . $sql_common;
$row = sql_fetch($sql);
$total_count = $row[cnt];
$rows = $config[cf_page_rows];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page == "") { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$sql = " select * $sql_common and is_confirm = '1' order by $sort1 $sort2, is_id desc limit $from_record, $rows ";
$result = sql_query($sql);
$qstr = "page=$page&sort1=$sort1&sort2=$sort2";
?>
<table cellpadding="0" cellspacing="0" width="100%" border="0" style="margin:30px 0 10px 0px; width:100%;">
<colgroup width="150" />
<colgroup width="" />
<colgroup width="80" />
<colgroup width="80" />
<tr><td colspan="4" height="2" bgcolor="#373737"></td></tr>
<tr align="center" class="ht" height="30">
<td><a href='<? echo title_sort("it_name"); ?>'>구매 상품명</a></td>
<td><a href='<? echo title_sort("is_subject"); ?>'>제목</a></td>
<td><a href='<? echo title_sort("mb_name"); ?>'>구매자</a></td>
<td><a href='<? echo title_sort("is_score"); ?>'>점수</a></td>
</tr>
<tr><td colspan="5" height="1" bgcolor="#373737"></td></tr>
<script type='text/javascript'>
function onoff(obj) {
var obj = document.getElementById(obj);
if(obj.style.display == 'none') obj.style.display = 'block';
else obj.style.display = 'none';
}
</script>
<?
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$row[is_subject] = cut_str($row[is_subject], 50, "...");
$is_content = conv_content($row[is_content],0);
//$is_content = cut_str(conv_content($row[is_content],0), 80, "...");
$href = "$g4[shop_path]/item.php?it_id=$row[it_id]";
// $href_ps = "$g4[shop_path]/item.php?it_id=$row[it_id]#item_ps";
$name = get_text($row[is_name]);
$star = get_star($row[is_score]);
$list = $i%2;
echo "
<tr class='list$list'>
<td style='padding-top:5px; padding-bottom:5px;' align=center><a href='$href'>".get_it_image("{$row[it_id]}_s", 120, 120)."<br />
<a href='$href'>".cut_str($row[it_name],50)."</a></td>
<td style='padding-top:5px; padding-bottom:5px; padding-left:10px; padding-right:10px;'><b><span style='cursor:hand' onclick=onoff('$i');>$row[is_subject]</span></b><br><br>
<div id='$i' style='display:none;'>".$is_content."</div>
</td>
<td align='center'>$name</td>
<td align='center'><img src=".$g4[shop_img_path]."/star".$star.".gif></td>
</tr>
<tr><td colspan='4' background='/shop/img/line_h.gif'></td></tr>";
}
if ($i == 0) {
echo "<tr><td colspan='4' align='center' height='100' bgcolor='#070707' class='point'>이용 후기가 한건도 없습니다.</td></tr>\n";
}
?>
</table>
<table width="100%">
<tr>
<td width="50%"> </td>
<td width="50%" align="right"><?=get_paging($config[cf_write_pages], $page, $total_page, "$_SERVER[PHP_SELF]?$qstr&page=");?></td>
</tr>
</table>
<form name=flist style="margin:0px;">
<input type="hidden" name="doc" value="<? echo $doc ?>" />
<input type="hidden" name="sort1" value="<? echo $sort1 ?>" />
<input type="hidden" name="sort2" value="<? echo $sort2 ?>" />
<input type="hidden" name="page" value="<? echo $page ?>" />
<table width="100%" cellpadding="4" cellspacing="0" border="0">
<tr>
<td width="10%"><a href='<?=$_SERVER[PHP_SELF]?>'>처음</a></td>
<td width="80%" align="center">
<select name="sel_ca_id">
<option value=''>전체분류</option>
<?
$sql1 = " select ca_id, ca_name from $g4[yc4_category_table] order by ca_id ";
$result1 = sql_query($sql1);
for ($i=0; $row1=mysql_fetch_array($result1); $i++) {
$len = strlen($row1[ca_id]) / 2 - 1;
$nbsp = "";
for ($i=0; $i<$len; $i++) $nbsp .= " ";
echo "<option value='$row1[ca_id]'>$nbsp$row1[ca_name]</option>\n";
}
?>
</select>
<script> document.flist.sel_ca_id.value = '<?=$sel_ca_id?>';</script>
<select name="sel_field">
<option value='it_name'>상품명</option>
<option value='a.it_id'>상품코드</option>
</select>
<? if ($sel_field) echo "<script> document.flist.sel_field.value = '$sel_field';</script>"; ?>
<input type="text" name="search" value='<? echo $search ?>' />
<input type="image" src='<?=$g4[admin_path]?>/img/btn_search.gif' align=absmiddle />
</td>
<td width="10%" align="right">건수 : <? echo $total_count ?> </td>
</tr>
</table>
</form>
<?
include_once("./_tail.php");
?>
관련자료
http://sir.kr/bbs/board.php?bo_table=yc4_tiptech&wr_id=720
제목누르면 아래에 해당후기 내용이 보입니다.
shop/itemps.all3.php 파일을 생성
<?
include_once("./_common.php");
$g4[title] = "사용후기모음";
include_once("./_head.php");
$sql_search = " where 1 ";
if ($search != "") {
if ($sel_field != "") {
$sql_search .= " and $sel_field like '%$search%' ";
}
}
if ($sel_ca_id != "") {
$sql_search .= " and ca_id like '$sel_ca_id%' ";
}
if ($sel_field == "") $sel_field = "it_name";
if (!$sort1) $sort1 = "is_id";
if (!$sort2) $sort2 = "desc";
$sql_common = " from $g4[yc4_item_ps_table] a
left join $g4[yc4_item_table] b on (a.it_id = b.it_id)
left join $g4[member_table] c on (a.mb_id = c.mb_id) ";
$sql_common .= $sql_search;
// 테이블의 전체 레코드수만 얻음
$sql = " select count(*) as cnt " . $sql_common;
$row = sql_fetch($sql);
$total_count = $row[cnt];
$rows = $config[cf_page_rows];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page == "") { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$sql = " select * $sql_common and is_confirm = '1' order by $sort1 $sort2, is_id desc limit $from_record, $rows ";
$result = sql_query($sql);
$qstr = "page=$page&sort1=$sort1&sort2=$sort2";
?>
<table cellpadding="0" cellspacing="0" width="100%" border="0" style="margin:30px 0 10px 0px; width:100%;">
<colgroup width="150" />
<colgroup width="" />
<colgroup width="80" />
<colgroup width="80" />
<tr><td colspan="4" height="2" bgcolor="#373737"></td></tr>
<tr align="center" class="ht" height="30">
<td><a href='<? echo title_sort("it_name"); ?>'>구매 상품명</a></td>
<td><a href='<? echo title_sort("is_subject"); ?>'>제목</a></td>
<td><a href='<? echo title_sort("mb_name"); ?>'>구매자</a></td>
<td><a href='<? echo title_sort("is_score"); ?>'>점수</a></td>
</tr>
<tr><td colspan="5" height="1" bgcolor="#373737"></td></tr>
<script type='text/javascript'>
function onoff(obj) {
var obj = document.getElementById(obj);
if(obj.style.display == 'none') obj.style.display = 'block';
else obj.style.display = 'none';
}
</script>
<?
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$row[is_subject] = cut_str($row[is_subject], 50, "...");
$is_content = conv_content($row[is_content],0);
//$is_content = cut_str(conv_content($row[is_content],0), 80, "...");
$href = "$g4[shop_path]/item.php?it_id=$row[it_id]";
// $href_ps = "$g4[shop_path]/item.php?it_id=$row[it_id]#item_ps";
$name = get_text($row[is_name]);
$star = get_star($row[is_score]);
$list = $i%2;
echo "
<tr class='list$list'>
<td style='padding-top:5px; padding-bottom:5px;' align=center><a href='$href'>".get_it_image("{$row[it_id]}_s", 120, 120)."<br />
<a href='$href'>".cut_str($row[it_name],50)."</a></td>
<td style='padding-top:5px; padding-bottom:5px; padding-left:10px; padding-right:10px;'><b><span style='cursor:hand' onclick=onoff('$i');>$row[is_subject]</span></b><br><br>
<div id='$i' style='display:none;'>".$is_content."</div>
</td>
<td align='center'>$name</td>
<td align='center'><img src=".$g4[shop_img_path]."/star".$star.".gif></td>
</tr>
<tr><td colspan='4' background='/shop/img/line_h.gif'></td></tr>";
}
if ($i == 0) {
echo "<tr><td colspan='4' align='center' height='100' bgcolor='#070707' class='point'>이용 후기가 한건도 없습니다.</td></tr>\n";
}
?>
</table>
<table width="100%">
<tr>
<td width="50%"> </td>
<td width="50%" align="right"><?=get_paging($config[cf_write_pages], $page, $total_page, "$_SERVER[PHP_SELF]?$qstr&page=");?></td>
</tr>
</table>
<form name=flist style="margin:0px;">
<input type="hidden" name="doc" value="<? echo $doc ?>" />
<input type="hidden" name="sort1" value="<? echo $sort1 ?>" />
<input type="hidden" name="sort2" value="<? echo $sort2 ?>" />
<input type="hidden" name="page" value="<? echo $page ?>" />
<table width="100%" cellpadding="4" cellspacing="0" border="0">
<tr>
<td width="10%"><a href='<?=$_SERVER[PHP_SELF]?>'>처음</a></td>
<td width="80%" align="center">
<select name="sel_ca_id">
<option value=''>전체분류</option>
<?
$sql1 = " select ca_id, ca_name from $g4[yc4_category_table] order by ca_id ";
$result1 = sql_query($sql1);
for ($i=0; $row1=mysql_fetch_array($result1); $i++) {
$len = strlen($row1[ca_id]) / 2 - 1;
$nbsp = "";
for ($i=0; $i<$len; $i++) $nbsp .= " ";
echo "<option value='$row1[ca_id]'>$nbsp$row1[ca_name]</option>\n";
}
?>
</select>
<script> document.flist.sel_ca_id.value = '<?=$sel_ca_id?>';</script>
<select name="sel_field">
<option value='it_name'>상품명</option>
<option value='a.it_id'>상품코드</option>
</select>
<? if ($sel_field) echo "<script> document.flist.sel_field.value = '$sel_field';</script>"; ?>
<input type="text" name="search" value='<? echo $search ?>' />
<input type="image" src='<?=$g4[admin_path]?>/img/btn_search.gif' align=absmiddle />
</td>
<td width="10%" align="right">건수 : <? echo $total_count ?> </td>
</tr>
</table>
</form>
<?
include_once("./_tail.php");
?>
관련자료
http://sir.kr/bbs/board.php?bo_table=yc4_tiptech&wr_id=720
댓글목록
등록된 댓글이 없습니다.