Web: Development

With my sketches out of the way, it was time to develop them in HTML and CSS. I wanted to use HTML5's new semantic elements, which is why you'll notice tags like 'header' instead of 'div id="header"' being used.

RSS Parsing
  1. On line 33, we create our own function called 'getFeed', which we can pass an RSS URL to.
  2. On line 35, we get and store the entire file contents at the URL we passed to our function.
  3. On line 36, we pass the stored file to PHP's own function, SimpleXmlElement(), this turns the file contents into an object we can manipulate.
  4. On line 39, we run a loop through the SimpleXmlElement object of our file, grabbing the text between each XML tag we want.
    1. We echo (in this case, print to document) the contents of the TITLE between 'h2' tags,
    2. the contents of LINK between 'a' tags,
    3. and the contents of DESCRIPTION between 'p' tags.
  5. The loop is told to break when it has done four iterations!
RSS Parser

No comments:

Post a Comment