상단메뉴출력을 db 로 끌어오기 정보
상단메뉴출력을 db 로 끌어오기관련링크
본문
ㄱ. 상단메뉴를 게시판 제목을 불러옵니다.
ㄴ. 하위분류($sca)가 존재할경우 대분류 하단에 출력.(가로형)
ㄷ. 하루분류($sca)를 좌측에 출력하고 싶은경우.
-------------------------------------------------------
ㄱ. 상단메뉴
<!--상단메뉴-->
<?
// 상단 메뉴를 축출.
$g4[g4_board] = "g4_board";
$top_mct = "gr_id = 'topmenu'";
$top_sql = " select bo_table,bo_subject from $g4[g4_board] where $top_mct ";
$top_result = sql_query($top_sql);
?>
<!--상단 시작-->
<table width="950" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
생략
</td>
</tr>
<tr>
<td>
<!--상단메뉴 시작-->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="193"><a href="<?=$g4[path]?>" target="_self"><img src="<?=$g4[path]?>/images/top_menu_banner.gif" width="193" border="0"></a></td>
<td background="<?=$g4[path]?>/images/top_menu_bg.gif" align="center" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td height=10></td></tr>
<tr><td align="center">
<? while ($top_row = sql_fetch_array($top_result)){?>
<a href="<?=$g4[path]?>/bbs/board.php?bo_table=<?=$top_row[bo_table]?>" target="_self" class=menu>
<span style='color:#593535;' class=ll><?=$top_row[bo_subject]?></span></a>
<span style='color:#593535;' class=ll>|</span>
<?}?>
</td></tr></table>
</td>
<td width="7"><img src="<?=$g4[path]?>/images/top_menu_rig.gif" width="7" height="70"></td>
</tr>
</table>
<!--상단메뉴 끝-->
</td>
</tr>
</table>
<!--상단 끝-->
2. 하위카테고리 호출시
<!--------------메뉴를 db table 에서 호출----------------------------->
<?
// 자주 사용할 경우는 개인 함수화 함.
$sql = " select bo_category_list from $g4[board_table] where bo_table = '$bo_table' ";
$row = sql_fetch($sql);
$arr = explode("|", $row[bo_category_list]); // 구분자가 , 로 되어 있음
// $str = "";
//bo_table 추가될경우를 대비하여.. switch 구문으로 처리
switch($bo_table){
case 'top01':
{?><td colspan="5" height="31" background="<?=$g4[image_path]?>/sub01_sub_bg.gif">
<table border="0" cellspacing="0" cellpadding="0" width="700">
<tr>
<td width="15"></td><td> <?}
for ($i=0; $i<count($arr); $i++){
if (trim($arr[$i])){?>
<?echo "<span style='font-family:Tahoma;font-size:9pt;color:#ff6600;'>
<a href='$g4[path]/bbs/board.php?bo_table=$bo_table&sca=$arr[$i]'>
{$arr[$i]}</a></span>";?> |
<?}
}
{?></td></tr>
</table>
</td><?}
break;
적용한 사이트 (상단메뉴 적용된 다양한 형태입니다.)
http://fla001.cafe79.net/gnu (기본형태)
http://fla002.cafe79.net/gnu (뮤죤운영)
http://fla003.cafe79.net/gnu (다른분. 허락받음)
http://fla004.cafe79.net/gnu (허락받음)
http://fla005.cafe79.net/gnu/ (허락받음)
ㄴ. 하위분류($sca)가 존재할경우 대분류 하단에 출력.(가로형)
ㄷ. 하루분류($sca)를 좌측에 출력하고 싶은경우.
-------------------------------------------------------
ㄱ. 상단메뉴
<!--상단메뉴-->
<?
// 상단 메뉴를 축출.
$g4[g4_board] = "g4_board";
$top_mct = "gr_id = 'topmenu'";
$top_sql = " select bo_table,bo_subject from $g4[g4_board] where $top_mct ";
$top_result = sql_query($top_sql);
?>
<!--상단 시작-->
<table width="950" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
생략
</td>
</tr>
<tr>
<td>
<!--상단메뉴 시작-->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="193"><a href="<?=$g4[path]?>" target="_self"><img src="<?=$g4[path]?>/images/top_menu_banner.gif" width="193" border="0"></a></td>
<td background="<?=$g4[path]?>/images/top_menu_bg.gif" align="center" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td height=10></td></tr>
<tr><td align="center">
<? while ($top_row = sql_fetch_array($top_result)){?>
<a href="<?=$g4[path]?>/bbs/board.php?bo_table=<?=$top_row[bo_table]?>" target="_self" class=menu>
<span style='color:#593535;' class=ll><?=$top_row[bo_subject]?></span></a>
<span style='color:#593535;' class=ll>|</span>
<?}?>
</td></tr></table>
</td>
<td width="7"><img src="<?=$g4[path]?>/images/top_menu_rig.gif" width="7" height="70"></td>
</tr>
</table>
<!--상단메뉴 끝-->
</td>
</tr>
</table>
<!--상단 끝-->
2. 하위카테고리 호출시
<!--------------메뉴를 db table 에서 호출----------------------------->
<?
// 자주 사용할 경우는 개인 함수화 함.
$sql = " select bo_category_list from $g4[board_table] where bo_table = '$bo_table' ";
$row = sql_fetch($sql);
$arr = explode("|", $row[bo_category_list]); // 구분자가 , 로 되어 있음
// $str = "";
//bo_table 추가될경우를 대비하여.. switch 구문으로 처리
switch($bo_table){
case 'top01':
{?><td colspan="5" height="31" background="<?=$g4[image_path]?>/sub01_sub_bg.gif">
<table border="0" cellspacing="0" cellpadding="0" width="700">
<tr>
<td width="15"></td><td> <?}
for ($i=0; $i<count($arr); $i++){
if (trim($arr[$i])){?>
<?echo "<span style='font-family:Tahoma;font-size:9pt;color:#ff6600;'>
<a href='$g4[path]/bbs/board.php?bo_table=$bo_table&sca=$arr[$i]'>
{$arr[$i]}</a></span>";?> |
<?}
}
{?></td></tr>
</table>
</td><?}
break;
적용한 사이트 (상단메뉴 적용된 다양한 형태입니다.)
http://fla001.cafe79.net/gnu (기본형태)
http://fla002.cafe79.net/gnu (뮤죤운영)
http://fla003.cafe79.net/gnu (다른분. 허락받음)
http://fla004.cafe79.net/gnu (허락받음)
http://fla005.cafe79.net/gnu/ (허락받음)
추천
1
1
댓글 0개