• Lucid Dreaming - Dream Views




    Results 1 to 12 of 12
    1. #1
      !DIREKTOR! Adam's Avatar
      Join Date
      Jan 2007
      Gender
      Location
      Aquanina's closet
      Posts
      5,195
      Likes
      34

      XML to HTML/PHP web page

      Another question from me.

      I have an XML feed (http://www.djdownload.com/xml/affili...ys-electro.xml) which I want to be displayed on my web site - of course this will update my site automatically for me. But the problem I have is I cannot find a way to display this XML contents on my website.

      Does anyone know how to do it? I have looked on 'G to the oogle' but only things I can see are pay-to-convert tools etc. Is there a way I can write some code on my site to populate this XML and auto update when the XML changes? Read something about using Java or an XSL sheet?

      Any help please?

      Adam.

    2. #2
      FBI agent Ynot's Avatar
      Join Date
      Oct 2005
      Gender
      Location
      Southend, Essex
      Posts
      4,337
      Likes
      14
      if you have php on your site,
      you can just include it into your own page

      your page (with xml feed included) can have whatever stylesheet you wish for formatting

      Code:
      <html>
      <head>
      <link rel="stylesheet" type="text/css" href="ext-feed.css" />
      </head>
      
      <body>
      
      <?php
      include("http://www.djdownload.com/xml/affiliate/top10-7days-electro.xml");
      ?>
      
      </body>
      </html>
      (\_ _/)
      (='.'=)
      (")_(")

    3. #3
      FBI agent Ynot's Avatar
      Join Date
      Oct 2005
      Gender
      Location
      Southend, Essex
      Posts
      4,337
      Likes
      14
      see this for stylesheets with XML
      http://www.w3schools.com/xml/xml_display.asp
      (\_ _/)
      (='.'=)
      (")_(")

    4. #4
      !DIREKTOR! Adam's Avatar
      Join Date
      Jan 2007
      Gender
      Location
      Aquanina's closet
      Posts
      5,195
      Likes
      34
      Ah so a simple php include would do this lol - There was me trying al sorts of js etc to try get it working.

      I have a couple of php includes on the pages so shouldn't be any issue adding one more. Will give it a go tonight, thanks.

    5. #5
      FBI agent Ynot's Avatar
      Join Date
      Oct 2005
      Gender
      Location
      Southend, Essex
      Posts
      4,337
      Likes
      14
      it's not ideal

      if 1000 people hit your site in a day,
      then your site will hit the xml feed 1000 times
      (you do have permission to grab this feed, yeah? else you may piss off the operators of DJ Download)

      ideally, and depending on how much control you've got over your webserver, setting up some sort of weekly cronjob would be best
      then you've got the feed locally on your side
      (plus you will be able to do more with it)

      but get it working how you want first, before trying stuff like that
      (\_ _/)
      (='.'=)
      (")_(")

    6. #6
      !DIREKTOR! Adam's Avatar
      Join Date
      Jan 2007
      Gender
      Location
      Aquanina's closet
      Posts
      5,195
      Likes
      34
      Yeah I have a deal with DJ Download so need this on my site - Basically I get around 1500 hits a week, and have a deal with them, that every customer I can send to them, I make money on - an affiliate deal.

      I will give this a go later, I am assuming that there would be no formatting of this feed though given the php is only going to grab the information on stick it in the site?

    7. #7
      FBI agent Ynot's Avatar
      Join Date
      Oct 2005
      Gender
      Location
      Southend, Essex
      Posts
      4,337
      Likes
      14
      Quote Originally Posted by Adam View Post
      I am assuming that there would be no formatting of this feed though given the php is only going to grab the information on stick it in the site?
      correct,
      but notice in my example above, the reference to the "ext-feed.css" stylesheet?

      you can use this to format the xml elements


      <track> tags into <div> tags
      value of <PreviewURL> to <a href=value>Preview</a>

      etc.
      (\_ _/)
      (='.'=)
      (")_(")

    8. #8
      FBI agent Ynot's Avatar
      Join Date
      Oct 2005
      Gender
      Location
      Southend, Essex
      Posts
      4,337
      Likes
      14
      just testing it out on my work server,
      and there's a few gotchas

      seems file operations on URL's is disabled by default (at least on my distro)
      so you'll have to make sure you've got this enabled
      also, php will puke on the <? XML tags if you have the short tags enabled
      so make sure they're disabled

      other than that,
      you're good to go

      Just need to make the css for styling


      [Links removed]
      Last edited by Man of Steel; 07-09-2008 at 12:48 AM. Reason: Removed link on request.

    9. #9
      !DIREKTOR! Adam's Avatar
      Join Date
      Jan 2007
      Gender
      Location
      Aquanina's closet
      Posts
      5,195
      Likes
      34
      o0o0o okay looks like I could have a little trouble then.

      Thanks for looking into this for me. I will give it a go tonight when I get in from football, about 8pm. Do you have MSN if I need some emergency contact? lol

      Thanks for all your help so far

    10. #10
      FBI agent Ynot's Avatar
      Join Date
      Oct 2005
      Gender
      Location
      Southend, Essex
      Posts
      4,337
      Likes
      14
      just PM me on here if you have any issues
      (\_ _/)
      (='.'=)
      (")_(")

    11. #11
      !DIREKTOR! Adam's Avatar
      Join Date
      Jan 2007
      Gender
      Location
      Aquanina's closet
      Posts
      5,195
      Likes
      34
      Thanks,

      You have PM already lol

    12. #12
      Member Identity X's Avatar
      Join Date
      Mar 2004
      Gender
      Posts
      1,529
      Likes
      7
      Just link a stylesheet to the XML and link to the XML directly.

      Or if you're a real man XSLT.

    Bookmarks

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •