I am writing a news content management system where the files HAVE to be named like this
news1.txt
news2.txt
news3.txt
[...]
news7.txt
etc, etc
The number is very important as that's how the flash works (and reads in the correct news count, etc). So far, I have got the admin system to work in the following fashion
Step 1
Read in the contents of the directory, load the files into an array that looks like this
$newsArray[1][title] = "Article 1's Title"
$newsArray[1][content] = "Article 1's Content"
$newsArray[2][title] = "Article 2's Title"
$newsArray[2][content] = "Article 2's Content"
etc, etc
Step 2
The user can manipulate the array by moving "articles" up and down the stack (whereby it changes the Array KEY and renumbers the rest accordingly). Likewise the user can also edit the contents of any array item (eg: the title and contents of $newsArray[2])
Step 3
The array is written back to disk as text files (eg: $newsArray[1] => news1.txt, $newsArray[2] => news2.txt, etc, etc)
This is all fine, and works great for creating new articles, moving articles around and editing existing articles, but I can't for the life of me work out how to delete an article!!
Logic would dictate that I could shove the offending article ($newsArray[$delThisOne]) to the end of the array and then array_pop() it off the end - but I'm not sure this is the best approach.
Do you have any ideas on this matter?
Thanks in advance
jonny.