After already researching this problem I found that it came about from lines of space between code outside of the php tags. However, I have removed all the lines of space i could possibly find, and i am still recieving the error.
Can somebody see what I'm doing wrong here? sorry if its an easy, fix; I'm a bit of a php newbie. Here's the code of the entire page (note there are no spaces within the included css file either):
Looks like you are trying to generate a XML document (the RSS) within the middle of a XHTML document. That's not going to work. The RSS document will need to be served up as a separate XML file.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
This error appears to come from your <?XML.... statement at the start of the rss file, not your <?PHP statement. Did you intend on echoing the RSS to the browser, or are you trying to make a file from it?
bascially what im trying to do is create an rss feed that is automatically updated when I add something new to the database. I was under the impression that what I have written would do that!
yeh tracknut, your right, but when it states what line its referring to in the error (line 25).. it points the php tag for some reason, as that is all that is on line 25.
bascially what im trying to do is create an rss feed that is automatically updated when I add something new to the database. I was under the impression that what I have written would do that!
yeh tracknut, your right, but when it states what line its referring to in the error (line 25).. it points the php tag for some reason, as that is all that is on line 25.
What you're doing generally looks fine, just replace your "echo" statements with the relevant "fopen" and "fwrite" or any other number of ways to write to a file instead.
Rule #17 of programming: take any line numbers with a grain of salt
The error you are seeing is not a PHP error. It is a client-side error from your browser trying to interpret the output you are sending to it. To reiterate, you cannot have an XML document embedded in the middle of a XHTML document. All the RSS generation stuff needs to be in a separate PHP file that only outputs the XML.
If you want that data displayed within your main XHTML document, then you'll need to load the XML by accessing it via a URL (or by including it with output buffering and then dumping the buffer to a variable) and parse/process its output into the desired XHTML output.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
ok, i have now changed the code, and im getting the error "can't open file", this is becuase the xml file im opening to write wont open, and im not sure why. here's the code, any ideas why it wont work?
Bookmarks