Hello,
I am writing a news script just for fun. What I want is each news entry to be kept in a separate txt file called 'news$i' where $i will increase with each news entry. That way it's much easer to print the news out just using php_get_contents(), no need to separate news etc.
So what I did what to make an array with each index equal to itself, so 2 is 2... Sounds stupid but I am using a lot of count($myarray) to write and read to the file. Anyways, nothing really worked 🙁 I don't want to go into too much details here...
So please help: how would YOU make a system like this with a separate txt file for each news? I mean, you DO need some kind of a count variable to open up all files and print all the news using fopen("news$count.txt", "r"), to write to the file etc. Oh, and also the problem is... I need to access these count details from all my 6 scripts, so I guess I need an include file with these details. But can I modify the include file in the file where it was included (because count needs to be incremented etc.).
Ok, so what's the best way to do all this?
P.S. Hehe, I know MySQL is better and if I am going public with this script, I'll use MySQL but just curios how to DO exactly that with text files?