You are here:  » Creating PHP File help


Creating PHP File help

Submitted by snoopy on Tue, 2006-08-01 17:51 in

Hi Very new to magic parse. we have xml feed http://www.newsoftheworld.co.uk/notw_sport_feed.xml

and we want to create and exact replicer of the original site http://www.newsoftheworld.co.uk/ its all the news from the left column about sport.

Hope someone can help.

Cheers

Submitted by support on Tue, 2006-08-01 18:18

Hi,

The feed certainly works with Magic Parser. Although it is not an RSS feed, you could base your code on the BBC News Headlines example, and i've created a demo script using the image and teaser links in this feed:

News Of The World Headlines

Here's the source code to the above example, which you can use as a starting point to add your own HTML and build the page to appear as you require.

<?php
  
require("MagicParser.php");
  function 
myRecordHandler($story)
  {
    print 
"<p>";
    print 
"<img align='left' src='".$story["IMG"]."' />&nbsp;";
    print 
"<strong><a href='".$story["LINK"]."'>".$story["TEASER"]."</a></strong>";
    print 
"<br /><br />";
    print 
"</p>";
  }
  print 
"<h1>News Of The World Headlines</h1>";
  
MagicParser_parse("http://www.newsoftheworld.co.uk/notw_sport_feed.xml","myRecordHandler","xml|NOTW/STORY/");
?>

Hope this helps!
David.