Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to append to the top of of a file?
#2
You can do that by first reading the contents of the file and then adding the new post at the begin of the file content, in the end save it.
I wouldn't do that, I would more suggest you to read the file into an array, line by line or preg_ functions.

After you have the array you look here for a sorting function that suits your needs.
I'll post a script in few mins, I'm busy right now!

EDIT:
When you save the posts, you can use bbCodes,
Code:
[poster]Motu[/poster][date]24.12.2009 01:39 AM[/date][post]Something[/post]

You would save this as single line into your file, then you can use the preg_replace function to sort the data.
Take a look here for the preg_replace
http://www.supportforums.net/showthread.php?tid=1676
Reply


Messages In This Thread
RE: How to append to the top of of a file? - by Gaijin - 12-23-2009, 05:27 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)