How to Display RSS in iFrame
An RSS feed publishes content that other websites and users can read. RSS feeds are written in XML, and the PHP dynamic programming language includes an RSS reader that you use to parse the data and display it in an iframe. You create the PHP page, and then you add the iframe to a Web page that points to the PHP page. The result is an RSS feed on your website that you can use to display the latest news.
Instructions
-
-
1
Right-click the PHP page you want to use to display the data. Click "Open With" and select your preferred editor.
-
2
Add the code to read the RSS feed, parse the data and display the output. The following code reads an RSS feed on a site named "mysite.com":
require_once "XML/RSS.php";
$rss =& new XML_RSS("mysite.com/feed.xml");
$rss->parse();
foreach ($rss->getItems() as $item) {
echo "Latest News: ".$item."<br>";
} -
-
3
Save the PHP file and open the HTML file in which you want to display the feed. Open the HTML file in your HTML editor.
-
4
Copy and paste the following iframe tag to the HTML code:
<iframe src="" width="100" height="100">
-
5
Add the PHP page name to the "src" property in the iframe. The following code shows the feed in the iframe:
<iframe src="feed.php" width="100" height="100">
Replace "feed.php" with the name of your PHP page.
-
1