티스토리 뷰

Language/PHP

XML 참조

MiniNeko 2015. 11. 29. 03:48

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns="http://www.w3.org/1999/xhtml">
< head>
< meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
< title>::경주향교::</title>
< link rel="stylesheet" type="text/css" href="/css/common.css" />
< link rel="stylesheet" type="text/css" href="/css/css.css" />
< /head>
< body>
< div id="wrap">
 <div id="header">
  <!-- top menu st -->
  <div class="top">
   <ul  class="gnb">
    <li style="padding-right:5px;"><a href="/"><img src="/image/btn_home.gif" width="30" height="7" alt="홈" /></a></li>
    <li class="btn"><a href="#"><img src="/image/btn_join.gif" width="37" height="7" alt="회원가입" /></a></li>
    <li class="btn"><a href="#"><img src="/image/btn_login.gif" width="30" height="7" alt="로그인" /></a></li>
    <li class="btn"><a href="#"><img src="/image/btn_sitemap.gif" width="42" height="7" alt="사이트맵" /></a></li>
   </ul>
   <!-- top menu en -->
   <ul class="logo">
    <li><a href="/"><img src="/image/logo.gif" width="157" height="52" alt="로고" /></a></li>
   </ul>
  <!-- navi st -->
   <div class="menu">
    <ul class="navi">
     <li><a href="/html/01_introduce/introduce_01.php"><img src="/image/btn_menu01.gif" width="70" height="17" alt="향교소개" /></a></li>
     <li><a href="/html/02_stay/stay_01.php"><img src="/image/btn_menu02.gif" width="112" height="16" alt="전통문화체험" /></a></li>
     <li><a href="/html/03_education/education_01.php"><img src="/image/btn_menu03.gif" width="88" height="16" alt="사회교육원" /></a></li>
     <li><a href="/html/04_wedding/wedding_01.php"><img src="/image/btn_menu04.gif" width="70" height="17" alt="전통혼례" /></a></li>
     <li><a href="/html/05_community/community_01.php"><img src="/image/btn_menu05.gif" width="70" height="15" alt="커뮤니티" /></a></li>
    </ul>
   </div>
  <!-- navi en -->
  </div>
 </div>
 <div id="container">
  <div class="contents">
   <ul class="sub_visual">
    <li><img src="/image/sub_visual.png" width="980" height="220" alt="sub visual" /></li>
   </ul>
   <div class="left">
    <ul class="title">
     <?
      $nowPageUrl = $_SERVER[REQUEST_URI]; 
      $firstStr = substr($nowPageUrl, 6, 2);
      $firstNum = number_format($firstStr);
      $secondStrTemp = explode(`/`,$nowPageUrl);
      $secondStr = substr($secondStrTemp[3], -6, 2);
      $secondNum = number_format($secondStr);
     ?>
     <li><img src="/image/sub_menu_tit<?=$firstStr?>.png" alt="sub_menu_tit<?=$firstStr?>.png" width="230" height="95" alt="" /></li>
    </ul>
    <ul class="cate">
    <?
     $xmlFile = new DOMDocument();
     $xmlFile->load($_SERVER[DOCUMENT_ROOT]."/swf/flash_menu.xml");
     $xmlData = $xmlFile->documentElement;
     //echo $xmlData->getElementsByTagName(`first`)->length;
     //echo $xmlData->getElementsByTagName(`first`)->item(1)->getElementsByTagName(`second`)->length;
     //echo $xmlData->getElementsByTagName(`first`)->item(1)->getElementsByTagName(`second`)->item(0)->getAttributeNode(`title`);
     //echo $xmlData->getElementsByTagName(`first`)->item(1)->getElementsByTagName(`second`)->item(0)->getAttribute(`title`);
//     foreach( $xmlData->childNodes AS $item) {
//      echo $item->first[0]->attributes(`url`)."<br />";
//     }
     for($i=1; $i<$xmlData->getElementsByTagName(`first`)->item($firstNum-1)->getElementsByTagName(`second`)->length+1; $i++ ) {
      $urlStr = $xmlData->getElementsByTagName(`first`)->item($firstNum-1)->getElementsByTagName(`second`)->item($i-1)->getAttribute(`url`);
    ?>
     <li><a href="<?=$urlStr?>"><img src="/image/subMenu/s_cate<?=$firstNum?>-<?=$i?>.jpg" alt="s_cate<?=$firstNum?>-<?=$i?>.jpg" /></a></li>
    <? } ?>
    </ul>
    <div class="banner">
     <ul class="blank">
      <li> </li>
     </ul>
     <ul class="image">
      <li><img src="/image/bn_cs.gif" width="189" height="37" alt="" /></li>
     </ul>
    </div>
    <div class="banner">
     <ul class="blank">
      <li> </li>
     </ul>
     <ul class="image">
      <li><img src="/image/bn_timetb.gif" width="189" height="37" alt="" /></li>
     </ul>
     <ul class="blank">
      <li> </li>
     </ul>
    </div>
   </div>
   <div class="content">
    <ul class="s_title">
     <!--li><img src="/image/stit_greeting.png" width="730" height="35" alt="" /></li-->
     <li><img src="/image/stitle<?=$firstNum?>-<?=$secondNum?>.png" alt="stitle<?=$firstNum?>-<?=$secondNum?>.png" width="730" height="35" alt="" /></li>
    </ul>
    <ul class="history">
     <li>Home</li>
     <li><?=$xmlData->getElementsByTagName(`first`)->item($firstNum-1)->getAttribute(`title`);?></li>
     <li><?=$xmlData->getElementsByTagName(`first`)->item($firstNum-1)->getElementsByTagName(`second`)->item($secondNum-1)->getAttribute(`title`);?></li>
    </ul>
    <div class="sub_content"> 

'Language > PHP' 카테고리의 다른 글

XML 문서파싱 - SAX 방식, DOM 방식  (0) 2015.11.29
img - image 이미지 크기 구하기 - GetImageSize()  (0) 2015.11.29
현제페이지 주소 알아내기  (0) 2015.11.29
달력  (0) 2015.11.29
방문자 카운트 만들기  (0) 2015.11.29
Total
Today
Yesterday
최근에 올라온 글
«   2025/01   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31