카테고리 정렬 문의드립니다. 정보
카테고리 정렬 문의드립니다.본문
영카트인데요 아래의 소스를 이용해서 2차 카테고리가 상단에 출력이 되더라구요
그런데 지금 나오는 출력방식이 쭉.. 이어져 나오더라구요..
그걸 6개 정도 나오고 줄 바꾸고 6개 나오고 줄바꾸고 이렇게 하고 싶습니다.
정렬을 좀 하고 싶어서요...
예를들어 지금은..
상품구분1(0) 상품구분2(0) 상품구분3(0) 상품구분4(0) 상품구분5(0) 상품구분6(0) 상품구분7(0) 상품구분8(0) 상품구분9(0) 상품구분10(0) 상품구분11(0) 상품구분12(0) 상품구분13(0) 상품구분14(0)
이렇게 쭉 나오거든요... 이걸
상품구분1(0) 상품구분2(0) 상품구분3(0) 상품구분4(0) 상품구분5(0)
상품구분6(0) 상품구분7(0) 상품구분8(0) 상품구분9(0) 상품구분10(0)
상품구분11(0) 상품구분12(0) 상품구분13(0) 상품구분14(0)
이런식으로 하고 싶습니다.
부탁드릴께요
<?
$str = "";
$exists = false;
$ca_id_len = strlen($ca_id);
$len2 = $ca_id_len + 2;
$len4 = $ca_id_len + 4;
// 차차기 분류의 건수를 얻음
$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_order, ca_id ";
$row = sql_fetch($sql);
$cnt = $row['cnt'];
if (!$cnt)
$str .= "<tr><td width=11 background='$g4[shop_img_path]/ca_bg02.gif'></td><td>";
$sql = " select ca_id, ca_name from $g4[yc4_category_table]
where ca_id like '$ca_id%'
and length(ca_id) = $len2
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)) {
//$row2 = sql_fetch(" select count(*) as cnt from $g4[yc4_category_table] where ca_id like '$row[ca_id]%' ");
$row2 = sql_fetch(" select count(*) as cnt from $g4[yc4_item_table] where (ca_id like '$row[ca_id]%' or ca_id2 like '$row[ca_id]%' or ca_id3 like '$row[ca_id]%') and it_use = '1' ");
$str .= "<a href='./list.php?ca_id=$row[ca_id]'>$row[ca_name] ($row2[cnt])</a> ";
$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>";
}
?>
댓글 전체