开发者

XML and HTML = need help using HTML code

开发者 https://www.devze.com 2022-12-25 12:55 出处:网络
I\'m converting my static HTML site to a dynamic PHP/XML-driven one. This开发者_如何学C is my current code:

I'm converting my static HTML site to a dynamic PHP/XML-driven one. This开发者_如何学C is my current code:

  <div class="divider"></div>
  <div class="main" style="width: 552px;">
   <div class="time">00:00</div>
   <div class="show"><h3><b>Radio Show</b></h3>
    <p>Description</p></div>
   <div class="footer"></div>
  </div>

and my XML file:

<?xml version="1.0"?>
<show>
 <showdesc>
 <divider1></divider1>
 <divmain></divmain>
 <airtime></airtime>
 <presenter></presenter>
    <showinfo></showinfo>
    <divfooter></divfooter>
    </showdesc>

which is the above HTML, that I'm trying to get into the XML file. I don't know how to get it to get the info in, I can display a simple XML page, as suggested here: http://www.kirupa.com/web/xml_php_parse_intermediate.htm but I am trying to in PHP get this to display what's in the XML pages or display this output: "Sorry. No schedule page is available" if the XML is blank, as above.

Anyone able to help me fix this? I've tried and tried but it's baffling me...


You don't need all the formatting stuff in your xml document. There are only three pieces of "real" information in the html snippet you've posted: title, time and description which you could format as

<show>
  <title>Radio Show</title>
  <time>00:00:00</time>
  <description>...</description>
</show>

In the example xml snippet there's also an element presenter. Where would that info be in the (existing) html data?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号