PDA

View Full Version : Is this possible in php?


kobescoresagain
08 May 2006, 05:40
I have a txt file that I need to edit using php. I understand how to open it and everything. I am just having problems adding text into the file. Basically here is what the actually file would generally look like.

Some random xml tags

<item>
</item>
<item>
</item>
<item>
</item>
<item>
</item>

two closing xml tags.

The tags at the beginning will change often, so I am not 100% sure what will be there. But it will not ever need to be edited through this code (all done manually).

I basically want to add items into this code. I want to add the items to the beginning on the item list, and after the beinning random xml tags. It would result in

Some random xml tags

<new item>
</new item>
<item>
</item>
<item>
</item>
<item>
</item>
<item>
</item>

two closing xml tags.

I have been told that I need to bring the data in 1 line at a time, but I am not 100% sure what exactly I need to do. Anyh guidance would be greatly appreciated.

Rimer dal
08 May 2006, 19:00
This is untested but it is the concept... I think it is was what you wanted.


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------