리자

리스트에서 분류를 2단계만 출력하기

· 18년 전 · 480
shop/listcategory3.inc.php
 
이 코드를 사용하시면 아래의 이미지 처럼 하위분류에서도 2단계 분류까지만 출력합니다.
 
depth2.gif
 
 
 
 
<?
$str = "";
$exists = false;
$depth2_ca_id = substr($ca_id, 0, 2);
$sql = " select ca_id, ca_name from $g4[yc4_category_table]
          where ca_id like '${depth2_ca_id}%'
            and length(ca_id) = 4
            and ca_use = '1'
          order by ca_id ";
$result = sql_query($sql);
$str .= "<tr><td width=11 background='$g4[shop_img_path]/ca_bg02.gif'></td>";
$str .= "<td><table width=100% border=0><tr><td>";
while ($row=sql_fetch_array($result)) {
    if (preg_match("/^$row[ca_id]/", $ca_id))
        $span = "<span style='font-weight:bold;'>";
    else
        $span = "<span>";
    $str .= "<a href='./list.php?ca_id=$row[ca_id]'>{$span}$row[ca_name]</span></a> &nbsp; ";
    $exists = true;
}
$str .= "</td></tr></table></td><td width=11 background='$g4[shop_img_path]/ca_bg03.gif'></td>";
if ($exists) {
    echo "
    <br>
    <table width=98% cellpadding=0 cellspacing=0 align=center border=0>
    <colgroup width=11>
    <colgroup width=''>
    <colgroup width=11>
    <tr>
        <td width=11><img src='$g4[shop_img_path]/ca_box01.gif'></td>
        <td background='$g4[shop_img_path]/ca_bg01.gif'></td>
        <td width=11><img src='$g4[shop_img_path]/ca_box02.gif'></td>
    </tr>
    $str
    <tr>
        <td width=11><img src='$g4[shop_img_path]/ca_box03.gif'></td>
        <td background='$g4[shop_img_path]/ca_bg04.gif'></td>
        <td width=11><img src='$g4[shop_img_path]/ca_box04.gif'></td>
    </tr>
    </table><br>";
}
?>
|
댓글을 작성하시려면 로그인이 필요합니다. 로그인

영카트4 팁자료실

영카트4와 관련된 팁과 자료를 공개하는 곳입니다. 영카트의 팁은 기본으로 제공하는 기능이 아니므로 고객지원의 대상이 아닙니다.

+
제목 글쓴이 날짜 조회
18년 전 조회 727
18년 전 조회 544
18년 전 조회 995
19년 전 조회 1,814
18년 전 조회 139
18년 전 조회 248
18년 전 조회 463
18년 전 조회 677
18년 전 조회 467
18년 전 조회 481
18년 전 조회 1,477
18년 전 조회 447
18년 전 조회 143
18년 전 조회 265
18년 전 조회 846
18년 전 조회 573
18년 전 조회 594
18년 전 조회 991
18년 전 조회 897
18년 전 조회 1,310
🐛 버그신고