상단메뉴출력을 db 로 끌어오기 > 그누4 팁자료실

그누4 팁자료실

그누보드4와 관련된 팁을 여러분들과 함께 공유하세요.
나누면 즐거움이 커집니다.

상단메뉴출력을 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>
          &nbsp;&nbsp;<span style='color:#593535;'  class=ll>|</span>&nbsp;&nbsp;
          <?}?>
          </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>";?>&nbsp;&nbsp;|&nbsp;&nbsp;
<?}

}
{?></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
  • 복사

댓글 0개

© SIRSOFT
현재 페이지 제일 처음으로