2017-07-18 59 views
0

這對我來說完全是新的。我有一個.xml文件,我試圖在div中顯示HTML文件中的信息而不是表格。做這件事的最佳途徑是什麼?如果需要,這將用於網站上的工作列表區域。 我從.xml文件中提供了一個示例,並且正在尋找標題,描述/位置,日期和鏈接以顯示在當前HTML所提供的div中,但會自動更新爲.xml文件更新。xml鏈接到HTML div

<?xml version="1.0"?> 
<rss version="2.0"> 
    <channel> 
      <item> 
       <title><![CDATA[Family Medicine Physician]]></title> 
       <link><![CDATA[display-job/201/Family-Medicine-Physician.html]]></link> 
       <description> 
        <![CDATA[Syracuse, NY 

        Our outpatient, primary care office has a new 
        opportunity for a Family Medicine Physician. 
      </description> 
      <pubDate>Tue, 11 Jul 2017 12:47:07 GMT</pubDate> 
      <guid><![CDATA[display-job/201/Family-Medicine-Physician.html]]></guid> 
     </item> 

HTML:

<!-- Start of Single Job Post 2 --> 
       <div class="single-job-post row nomargin"> 
        <!-- Job Company --> 


        <!-- Job Title & Info --> 
        <div class="col-md-8 col-xs-6 ptb20"> 
         <div class="job-title"> 
          <a href="JobPost.html">Family Medicine Physician</a> 
         </div> 

         <div class="job-info"> 
          <span class="company"><i class="fa fa-building-o"></i>Date</span> 
          <span class="location"><i class="fa fa-map-marker"></i>Syracuse, NY</span> 
         </div> 
        </div> 

        <!-- Job Category --> 
        <div class="col-md-2 col-xs-3 ptb30"> 
         <div class="job-category"> 
          <a href="display-job/194/Family-Medicine-Physician.html?searchId=1497985283.27&page=1" class="btn btn-green btn-small btn-effect">View Job</a> 
         </div> 
        </div> 
       </div> 
       <!-- End of Single Job Post 2 --> 

請讓我知道更多的infromaion,再次林新本,但學習。

回答

0

您可以根據需要使用PHP進行顯示。 爲此,使用函數simplexml_load_file(「file.xml」)。

試試這個tutorial

希望這有助於..