카테고리 3단 레이어입니다.
shop/boxcategory.inc.php 파일 수정
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
//
// 3단계 분류 레이어 표시
//
$menu = ""; // 메뉴 레이어 임시저장 변수 (처음엔 아무값도 없어야 합니다.)
$sub_menu_left = 100; // 2단계 메뉴 왼쪽 좌표 (1단계 좌표에서 부터)
$menu2 = ""; // 메뉴 레이어 임시저장 변수 (처음엔 아무값도 없어야 합니다.)
$sub_menu_left2 = 60; // 3단계 메뉴 왼쪽 좌표 (2단계 좌표에서 부터)
?>
<table bgcolor=#FFFFFF width=100% cellpadding=0 cellspacing=0>
<tr><td align=center valign=top height=50><img src='<?=$g4[shop_img_path]?>/bar_category.gif'></td></tr>
<?
// 1단계 분류 판매가능한것만
$hsql = " select ca_id, ca_name from $g4[yc4_category_table]
where length(ca_id) = '2'
and ca_use = '1'
order by ca_id ";
$hresult = sql_query($hsql);
$hnum = @mysql_num_rows($hresult);
for ($i=0; $row=sql_fetch_array($hresult); $i++)
{
// 2단계 분류
$menubody = "";
$onmouseover = "";
$onmouseout = "";
$sql2 = " select ca_id, ca_name from $g4[yc4_category_table]
where LENGTH(ca_id) = '4'
and SUBSTRING(ca_id,1,2) = '$row[ca_id]'
and ca_use = '1'
order by ca_id ";
$result2 = sql_query($sql2);
$hnum2 = @mysql_num_rows($result2);
for ($j=0; $row2=sql_fetch_array($result2); $j++)
{
// 3단계 분류
$menubody2 = "";
$onmouseover2 = "";
$onmouseout2 = "";
$sql3 = " select ca_id, ca_name from $g4[yc4_category_table]
where LENGTH(ca_id) = '6'
and SUBSTRING(ca_id,1,4) = '$row2[ca_id]'
and ca_use = '1'
order by ca_id ";
$result3 = sql_query($sql3);
$hnum3 = @mysql_num_rows($result3);
$menubody2 .= "<tr>";
for ($k=0; $row3=sql_fetch_array($result3); $k++)
{
if ( ($k>0) && (($k%2)==0) )
{
$menubody2 .= "</tr><tr><td colspan='2' height='1' bgcolor='#dddddd'></td></tr><tr>";
}
$menubody2 .= "<td width='180' height='22'> · <a href='$g4[shop_path]/list.php?ca_id=$row3[ca_id]'>$row3[ca_name]</a></td>";
}
// 나머지 td 를 채운다.
if (($cnt = $k%2) != 0)
for ($m=$cnt; $m<2; $m++)
$menubody2 .= "<td width='180' height='22'> </td>";
$menubody2 .= "</tr>";
if ($menubody2)
{
$onmouseover2 = " layer_view2('lmenu{$i}{$j}', 'lmenu_layer{$i}{$j}', 'view', $sub_menu_left2, -22); ";
$onmouseout2 = " layer_view2('lmenu{$i}{$j}', 'lmenu_layer{$i}{$j}', 'hide'); ";
}
$category_link2 = "<a href='$g4[shop_path]/list.php?ca_id=$row2[ca_id]'>";
if ($hnum3>0) {
$menubody .= "<tr id='lmenu{$i}{$j}' onmouseover=\"$onmouseover2\" onmouseout=\"$onmouseout2\"><td height='22'> · $category_link2$row2[ca_name]</a>\n";
} else {
$menubody .= "<tr><td height='22'> · $category_link2$row2[ca_name]</a>";
}
if ($hnum3>0 && $menubody2)
{
$menubody .= "<div id='lmenu_layer{$i}{$j}' style='width:360px; display:none; position:absolute; z-index:999;'>";
$menubody .= "<table cellpadding='1' cellspacing='0' bgcolor='#cccccc' width='100%'><tr><td>";
$menubody .= "<table border='0' width='100%' bgcolor='#ffffff' cellpadding='0' cellspacing='0'>$menubody2</table>";
$menubody .= "</td></tr></table>";
$menubody .= "</div>";
}
$menubody .= "</td></tr>";
// 맨밑줄은 출력하지 않음
if ($j < $hnum2-1)
$menubody .= "<tr><td height='1' bgcolor='#dddddd'></td></tr>";
}
if ($menubody)
{
$onmouseover = " layer_view('lmenu{$i}', 'lmenu_layer{$i}', 'view', $sub_menu_left, -22); ";
$onmouseout = " layer_view('lmenu{$i}', 'lmenu_layer{$i}', 'hide'); ";
}
$category_link = "<a href='$g4[shop_path]/list.php?ca_id=$row[ca_id]'>";
echo "<tr id='lmenu{$i}' onmouseover=\"$onmouseover\" onmouseout=\"$onmouseout\">";
echo "<td height='22'> · $category_link$row[ca_name]</a>\n";
if ($menubody)
{
//echo "<div id='lmenu_layer{$i}' style='width:180px; display:none; position:absolute; FILTER: alpha(opacity=95); z-index:998;'>";
echo "<div id='lmenu_layer{$i}' style='width:180px; display:none; position:absolute; z-index:998;'>";
echo "<table cellpadding=1 cellspacing=0 bgcolor=#CCCCCC width=100%><tr><td>";
echo "<table border=0 width=100% bgcolor=#FFFFFF cellpadding=0 cellspacing=0>$menubody</table>";
echo "</td></tr></table>";
echo "</div>";
}
echo "</td></tr>\n";
if ($i<$hnum-1) // 맨밑줄은 출력하지 않음
echo "<tr><td align=center><img src='$g4[shop_img_path]/dot_line.gif'></td></tr>\n";
}
if ($i==0)
echo "<tr><td height=50 align=center>등록된 자료가 없습니다.</td></tr>\n";
?>
</table>
<?=$menu?>
<?=$menu2?>
<script language="JavaScript">
var save_layer = null;
var save_layer2 = null;
function layer_view(link_id, menu_id, opt, x, y)
{
var link = document.getElementById(link_id);
var menu = document.getElementById(menu_id);
//for (i in link) { document.write(i + '<br/>'); } return;
if (save_layer != null)
save_layer.style.display = "none";
if (opt == 'hide')
{
menu.style.display = 'none';
}
else
{
x = parseInt(x);
y = parseInt(y);
menu.style.left = get_left_pos(link) + x + 'px';
menu.style.top = get_top_pos(link) + link.offsetHeight + y + 'px';
menu.style.display = 'block';
}
save_layer = menu;
}
function layer_view2(link_id, menu_id, opt, x, y)
{
var link2 = document.getElementById(link_id);
var menu2 = document.getElementById(menu_id);
//for (i in link2) { document.write(i + '<br/>'); } return;
if (save_layer2 != null)
save_layer2.style.display = "none";
if (opt == 'hide')
{
menu2.style.display = 'none';
}
else
{
x = parseInt(x);
y = parseInt(y);
menu2.style.left = get_left_pos(link2) + x + 'px';
//menu2.style.top = get_top_pos(link2) + link2.offsetHeight + y + 'px';
menu2.style.top = link2.offsetHeight + y + 'px';
menu2.style.display = 'block';
}
save_layer2 = menu2;
}
</script>
게시글 목록
| 번호 | 제목 |
|---|---|
| 1534 | |
| 1526 | |
| 1518 | |
| 1516 | |
| 1515 | |
| 1501 | |
| 1498 | |
| 1496 | |
| 1491 | |
| 1488 | |
| 1487 | |
| 1481 | |
| 1473 | |
| 1472 | |
| 1466 | |
| 1462 | |
| 1450 | |
| 1449 | |
| 1447 | |
| 1446 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기