Writing to a File With Delimeters in Between Variables
Posted: Sun Jan 24, 2010 5:35 pm
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:
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.
This is what I want to be written in the file:
Code: Select all
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>
P.S. The "</channel></rss>" at the end of the code are the static 16 characters I was talking about.