Hi, I am currently making an RSS creater using fwrite, but there seems to be a problem, the data gets submitted at the end therefore the newest data will not show first. Is there anyway I can get the data to be placed at the top of the file. Thanks everyone
hummm.. when using fopen change the opening mode like this: $handle = fopen("/home/test/public_html/text.txt", "r+"); Code (markup): The r+ at the end of that command opens the file for reading and writing and places the pointer at the beginning of the file. That way your new content will be printed first.
using r+ will remove all the data from the file and rewrite it to what new data needs to be added. I need a way for it to keep the data already in the file but to add more on top instead of the bottom. Thanks, EDIT: I have figured out a different way of doing this. If anyone wanted to know all I did was write what was already in the file to another file and I used, file_get_contents to use that data and re-append it into the rss file with the new data at the top. then i just used unlink to remove the file.
Any modern RSS reader is going to at least allow the reader to organize and order results according to item timestamps. You really don't need to bother yourself with the order which items appear in the feed.