Jump to content

Ajax RSS feed output raw html


robppc

Recommended Posts

Hello, i am trying to learn Ajax so i picked up a book and started reading. One the the projects in the book is to make a RSS reader. PHP is what grabs the RSS feed and outputs it, and it works pretty much the way it was intended to work with one little problem. When it updates the page element where it dumps the feed, it is outputting the raw html and it is not formatting it at all.

 

Does anyone know what i may be doing wrong?

Link to comment
Share on other sites

try html_entity_decode();

or

if you are using php5 you can use something like this:

<?php

// Works with php5 only!

// KJV verse of the day code starts here ----------------------------------------------------------------------------------------------------------->>
			print("<div class='greenbox-top'></div>
				<div class='greenbox-bg'>
				<h2>Verse Of The Day</h2>");
					$feed = simplexml_load_file('http://www.biblegateway.com/usage/votd/rss/votd.rdf?9');
					$namespaces = $feed->getNamespaces(true);
					$content = $feed->channel->item->children($namespaces['content']);
					$verse = $feed->channel->item->title;
					echo ("<p>".$verse."<br /><br />".str_ireplace('<br/><br/> Brought to you by <a href="http://www.biblegateway.com">BibleGateway.com</a>. Copyright (C) KJV. All Rights Reserved.','',$content->encoded)."</p>");
				print("</div>
			<div class='greenbox-bottom'></div>");
// KJV verse of the day code ends here -------------------------------------------------------------------------------------------------------------->>
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.