listcategory.inc.php 파일을 수정하기 전에 백업은 필수입니다.
가로 카테고리 메뉴의 가로갯수를 조절할 수 있으며 1차에 속한 2차분류를, 2차에 속한 3차 분류를 출력해줍니다.
2차나 3차 카테고리가 없으면 출력하지 않습니다.
<?
// 1차 카테고리 출력
$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>";
$str .= "<td><table width=100% border=0><tr>";
$list_mod = 5; ///////////////////////////////////////////////////// 가로 갯수
for ($i=0; $row=sql_fetch_array($result); $i++) {
if ($i > 0 && $i % $list_mod == 0) {
$str .= "</tr>\n\n<tr>\n";
}
$str .= "<td>ㆍ<a href='./list.php?ca_id=$row[ca_id]'>";
if (preg_match("/^$row[ca_id]/", $ca_id))
$font = "<font style='color:ff6600;font-size:11;font-weight:bold;'>";
else
$font = "<font style='font-size:11;'>";
$str .= "{$font}$row[ca_name]</font>";
$exists = true;
$str .= "</a> </td>";
}
// 나머지 td 를 채운다.
if (($cnt = $i%$list_mod) != 0)
for ($k=$cnt; $k<$list_mod; $k++)
$str .= "<td> </td>\n";
$str .= "</tr></table></td>";
if ($exists) {
echo "
<table width=98% cellpadding=0 cellspacing=0 align=center border=0>
$str
</table>";
}
// 2차 카테고리 출력 (1차 분류에 속한 것만)
$str2 = "";
$exists2 = false;
$depth2_ca_id = substr($ca_id, 0, 4);
$sql2 = " select ca_id, ca_name from $g4[yc4_category_table] where ca_id like '${depth2_ca_id}%' and length(ca_id) = 6 and ca_use = '1' order by ca_id ";
$result2 = sql_query($sql2);
$str2 .= "<tr>";
//$str2 .= "<td style='border-width:1; border-color:#dddddd; border-style:solid;'><table width=100% border=0><tr>";
$str2 .= "<td><table width=100% border=0><tr>";
$list_mod2 = 5; ///////////////////////////////////////////////////// 가로 갯수
for ($j=0; $row=sql_fetch_array($result2); $i++) {
if ($j > 0 && $j % $list_mod2 == 0) {
$str2 .= "</tr>\n\n<tr>\n";
}
$str2 .= "<td>ㆍ<a href='./list.php?ca_id=$row[ca_id]'>";
if (preg_match("/^$row[ca_id]/", $ca_id))
$font = "<font style='color:0099ff;font-size:11;font-weight:bold;'>";
else
$font = "<font style='font-size:11;'>";
$str2 .= "{$font}$row[ca_name]</font>";
$exists2 = true;
$str2 .= "</a> </td>";
}
// 나머지 td 를 채운다.
if (($cnt = $j%$list_mod2) != 0)
for ($k=$cnt; $k<$list_mod2; $k++)
$str2 .= "<td> </td>\n";
$str2 .= "</tr></table></td>";
if (substr($ca_id,2,6)){
if ($exists2) {
echo "
<table width=98% cellpadding=3 cellspacing=0 align=center border=0 bgcolor=#f0f0f0>
$str2
</table>";
} }
// 3차 카테고리 출력 (2차 분류에 속한것만)
$str3 = "";
$exists3 = false;
$depth2_ca_id = substr($ca_id, 0, 6);
$sql3 = " select ca_id, ca_name from $g4[yc4_category_table] where ca_id like '${depth2_ca_id}%' and length(ca_id) = 8 and ca_use = '1' order by ca_id ";
$result3 = sql_query($sql3);
$str3 .= "<tr>";
$str3 .= "<td style='border-width:1 0 0 0; border-color:#fefefe; border-style:solid;'><table width=100% border=0><tr>";
$list_mod3 = 5; ///////////////////////////////////////////////////// 가로 갯수
for ($l=0; $row=sql_fetch_array($result3); $i++) {
if ($l > 0 && $l % $list_mod3 == 0) {
$str3 .= "</tr>\n\n<tr>\n";
}
$str3 .= "<td>ㆍ<a href='./list.php?ca_id=$row[ca_id]'>";
if (preg_match("/^$row[ca_id]/", $ca_id))
$font = "<font style='color:000000;font-size:11;font-weight:bold;'>";
else
$font = "<font style='font-size:11;'>";
$str3 .= "{$font}$row[ca_name]</font>";
$exists3 = true;
$str3 .= "</a> </td>";
}
// 나머지 td 를 채운다.
if (($cnt = $l%$list_mod3) != 0)
for ($k=$cnt; $k<$list_mod; $k++)
$str3 .= "<td> </td>\n";
$str3 .= "</tr></table></td>";
if (substr($ca_id,4,4)){
if ($exists3) {
echo "
<table width=98% cellpadding=3 cellspacing=0 align=center border=0 bgcolor=#f8f8f8>
$str3
</table>";
} }
?>
댓글 1개
게시글 목록
| 번호 | 제목 |
|---|---|
| 1534 | |
| 1526 | |
| 1518 | |
| 1516 | |
| 1515 | |
| 1501 | |
| 1498 | |
| 1496 | |
| 1491 | |
| 1488 | |
| 1487 | |
| 1481 | |
| 1473 | |
| 1472 | |
| 1466 | |
| 1462 | |
| 1450 | |
| 1449 | |
| 1447 | |
| 1446 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기