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
https://forums.phpfreaks.com/topic/82361-ajax-rss-feed-output-raw-html/
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 -------------------------------------------------------------------------------------------------------------->>
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.