영카트 [YC5] 사용후기 전체모음
페이지 정보
본문
제품마다 입력된 구매후기를 한페이지에 모아서 보여줍니다.
제목누르면 아래에 해당후기 내용이 보입니다.
shop/itemps.all3.php 파일을 생성
<?php
include_once("./_common.php");
$g5['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 {$g5['g5_shop_item_use_table']} a
left join {$g5['g5_shop_item_table']} b on (a.it_id = b.it_id)
left join {$g5['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="<?php echo title_sort("it_name"); ?>">구매 상품명</a></td>
<td><a href="<?php echo title_sort("is_subject"); ?>">제목</a></td>
<td><a href="<?php echo title_sort("mb_name"); ?>">구매자</a></td>
<td><a href="<?php 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>
<?php
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 = G5_SHOP_URL."/item.php?it_id={$row['it_id']}";
//$href_ps = G5_SHOP_URL."/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; text-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=\"".G5_SHOP_URL."/img/s_star{$star}.png\"></td>
</tr>
<tr><td colspan=\"4\" background=\"".G5_SHOP_URL."/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 align="right"><?php echo get_paging($config['cf_write_pages'], $page, $total_page, "{$_SERVER['PHP_SELF']}?{$qstr}&page=");?></td>
</tr>
</table>
<fieldset id="bo_sch">
<legend>게시물 검색</legend>
<form name=flist style="margin:0px;">
<input type="hidden" name="doc" value="<?php echo $doc ?>" />
<input type="hidden" name="sort1" value="<?php echo $sort1 ?>" />
<input type="hidden" name="sort2" value="<?php echo $sort2 ?>" />
<input type="hidden" name="page" value="<?php echo $page ?>" />
<table width="100%" cellpadding="4" cellspacing="0" border="0">
<tr>
<td width="10%"><a href='<?php echo $_SERVER['PHP_SELF']?>'>처음</a></td>
<td width="80%" align="center">
<select name="sel_ca_id" class="frm_input">
<option value=''>전체분류</option>
<?php
$sql1 = " select ca_id, ca_name from {$g5['g5_shop_category_table']} order by ca_id ";
$result1 = sql_query($sql1);
for ($i=0; $row1=sql_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 = '<?php echo $sel_ca_id; ?>';</script>
<select name="sel_field" class="frm_input">
<option value='it_name'>상품명</option>
<option value='a.it_id'>상품코드</option>
</select>
<?php if ($sel_field) echo "<script> document.flist.sel_field.value = '{$sel_field}';</script>"; ?>
<input type="text" name="search" value='<?php echo $search ?>' class="frm_input required" >
<input type="submit" value="검색" class="btn_submit">
</td>
<td width="10%" align="right">건수 : <?php echo $total_count ?> </td>
</tr>
</table>
</form>
</fieldset>
<?php
include_once("./_tail.php");
?>
관련자료
http://sir.kr/bbs/board.php?bo_table=yc4_tiptech&wr_id=720
제목누르면 아래에 해당후기 내용이 보입니다.
shop/itemps.all3.php 파일을 생성
<?php
include_once("./_common.php");
$g5['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 {$g5['g5_shop_item_use_table']} a
left join {$g5['g5_shop_item_table']} b on (a.it_id = b.it_id)
left join {$g5['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="<?php echo title_sort("it_name"); ?>">구매 상품명</a></td>
<td><a href="<?php echo title_sort("is_subject"); ?>">제목</a></td>
<td><a href="<?php echo title_sort("mb_name"); ?>">구매자</a></td>
<td><a href="<?php 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>
<?php
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 = G5_SHOP_URL."/item.php?it_id={$row['it_id']}";
//$href_ps = G5_SHOP_URL."/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; text-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=\"".G5_SHOP_URL."/img/s_star{$star}.png\"></td>
</tr>
<tr><td colspan=\"4\" background=\"".G5_SHOP_URL."/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 align="right"><?php echo get_paging($config['cf_write_pages'], $page, $total_page, "{$_SERVER['PHP_SELF']}?{$qstr}&page=");?></td>
</tr>
</table>
<fieldset id="bo_sch">
<legend>게시물 검색</legend>
<form name=flist style="margin:0px;">
<input type="hidden" name="doc" value="<?php echo $doc ?>" />
<input type="hidden" name="sort1" value="<?php echo $sort1 ?>" />
<input type="hidden" name="sort2" value="<?php echo $sort2 ?>" />
<input type="hidden" name="page" value="<?php echo $page ?>" />
<table width="100%" cellpadding="4" cellspacing="0" border="0">
<tr>
<td width="10%"><a href='<?php echo $_SERVER['PHP_SELF']?>'>처음</a></td>
<td width="80%" align="center">
<select name="sel_ca_id" class="frm_input">
<option value=''>전체분류</option>
<?php
$sql1 = " select ca_id, ca_name from {$g5['g5_shop_category_table']} order by ca_id ";
$result1 = sql_query($sql1);
for ($i=0; $row1=sql_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 = '<?php echo $sel_ca_id; ?>';</script>
<select name="sel_field" class="frm_input">
<option value='it_name'>상품명</option>
<option value='a.it_id'>상품코드</option>
</select>
<?php if ($sel_field) echo "<script> document.flist.sel_field.value = '{$sel_field}';</script>"; ?>
<input type="text" name="search" value='<?php echo $search ?>' class="frm_input required" >
<input type="submit" value="검색" class="btn_submit">
</td>
<td width="10%" align="right">건수 : <?php echo $total_count ?> </td>
</tr>
</table>
</form>
</fieldset>
<?php
include_once("./_tail.php");
?>
관련자료
http://sir.kr/bbs/board.php?bo_table=yc4_tiptech&wr_id=720
댓글목록
등록된 댓글이 없습니다.