PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I've been following a tutorial on RSS feeds which utilises php and mysql. It creates a function and there doesnt seem to be any problems with it, at least I'm getting no warnings, notices or fatal errors.
Whats happening though is the following bit of code which is supposed to put the feed on the page is instead just echoing the function name:
Try viewing the source of the page - I think you'll find the source code maybe has some extra data - looks like maybe the opening < is being shown until the > found at the -> class pointer and so the whole lot is being taken as an HTML element.
Also I would try changing the initial line from <? to <?php.
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
System error: -2146697204. Error processing resource 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'.
Only I'm not sure what the problem can be, I'm new to RSS feeds like I said.
I cannot view the souce code if I try it says 'The XML source file is unavailable for viewing' So I guess soemthing is really messed up but I've only worked with plain XML pulled with javascript once or twice.
Like I said this is from a tutorial and there were no complaints with it not working.
So you're pulling the XML data via JavaScript. I think you said it works ok if you view the page directly in the browser rather than pulling it via JavaScript? Can you view the source then?
<?
//header("Content-Type: application/xml; charset=ISO-8859-1"); // commenting out this line
include("classes/RSSclass.php");
$rss = new RSS();
echo htmlspecialchars($rss->GetFeed()); // wrapping $rss->GetFeed() in htmlspecialchars()
?>
It should output the XML as HTML and you can see it on the browser page.
I'm afraid that didnt work, I may have to try something else out. I do have some access to other RSS feeds so will have to give it another try when I can acces them.