yortzec Posted January 24, 2010 Share Posted January 24, 2010 I need some help here. I am trying to use php to write to an rss file (Basically a Unicode-8 text file with extension ".rss") when a person writes a post on my website. I used a php script that I downloaded to set up several things for me, so I already have all the variables i will need. They are: $name, $comments, and $added, representing the title of an rss article, the article itself, and the date the article was written, respectively. I also know where to put the function to write to the file. (But I don't know what to put in it) I want to make the function not replace everything in the rss file i am writing to. There will have to be more text above where I want to write in the rss file, and a static number of characters below it. (To be exact, the text I want to put in must be 16 characters before the end of the document, but I can always add more returns as "buffer" characters, to be sure that the code won't be placed in the wrong place) I also will need to put certain text in between the characters, and you will get the idea in the code below. This is what I want to be written in the file: --Here will be lots of text giving information about the rss feed, which I will never need to change. (I found it unnecessary to post them here) --Earlier articles might be here <item xmlns:atom="http://www.w3.org/2005/Atom"> <title xmlns:atom="http://www.w3.org/2005/Atom">[b]$name[/b]</title> <link xmlns:atom="http://www.w3.org/2005/Atom"> http://simh.host56.com/simh/gbook/gbook.php</link> <guid xmlns:atom="http://www.w3.org/2005/Atom"> http://simh.host56.com/simh/gbook/gbook.php</guid> <description xmlns:atom="http://www.w3.org/2005/Atom">[b]$comments[/b]</description> <pubDate xmlns:atom="http://www.w3.org/2005/Atom">[b]$added[/b]</pubDate> </item> </channel> </rss> I hope you understand what I mean. Please ask if you need more information. Thanks so much for the help! P.S. The "</channel></rss>" at the end of the code are the static 16 characters I was talking about. Quote Link to comment https://forums.phpfreaks.com/topic/189666-help-writing-to-file-with-delimeters/ Share on other sites More sharing options...
MadTechie Posted January 24, 2010 Share Posted January 24, 2010 And what exactly are you stuck on ? this look more like a job brief and feel i should more it to the freelance section! Quote Link to comment https://forums.phpfreaks.com/topic/189666-help-writing-to-file-with-delimeters/#findComment-1000990 Share on other sites More sharing options...
yortzec Posted January 25, 2010 Author Share Posted January 25, 2010 Well....... kind of writing the entire function.....hehe.....hehe..... anyone want to walk me through it? Quote Link to comment https://forums.phpfreaks.com/topic/189666-help-writing-to-file-with-delimeters/#findComment-1000998 Share on other sites More sharing options...
teamatomic Posted January 25, 2010 Share Posted January 25, 2010 <?php //convert post vars $write_this=" <item xmlns:atom=\"http://www.w3.org/2005/Atom\"> <title xmlns:atom=\"http://www.w3.org/2005/Atom\">[b]$name[/b]</title> <link xmlns:atom=\"http://www.w3.org/2005/Atom\"> http://simh.host56.com/simh/gbook/gbook.php</link> <guid xmlns:atom=\"http://www.w3.org/2005/Atom\"> http://simh.host56.com/simh/gbook/gbook.php</guid> <description xmlns:atom=\"http://www.w3.org/2005/Atom\">[b]$comments[/b]</description> <pubDate xmlns:atom=\"http://www.w3.org/2005/Atom\">[b]$added[/b]</pubDate> </item> </channel></rss>'; file_put_contents($file.rss","$write_this"); ?> That will be $10.00 to any Haiti disaster fund. If you dont donate karma will force your hair to grow down, wrap around your eyeballs and blind you! HTH Teamatomic edited for screwed code Quote Link to comment https://forums.phpfreaks.com/topic/189666-help-writing-to-file-with-delimeters/#findComment-1001047 Share on other sites More sharing options...
yortzec Posted January 25, 2010 Author Share Posted January 25, 2010 Thank you so much! Quote Link to comment https://forums.phpfreaks.com/topic/189666-help-writing-to-file-with-delimeters/#findComment-1001057 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.