Most of the design that DavH mentioned is pretty standard for a RDBMS-based setup. One table for the news block and separate tables for related data. Admin auth: dead-simple way is to stuff all your admin scripts in a separate directory and secure it via a .htaccess file. No, its not very flexible, etc.. etc.. ,but it sounds like you're the only one modifying news.
But yes, it was a quick response.
Quote:
|
when i go to edit it, it puts all the titles and entry in form boxes all in the same form.
|
I don't follow. Do you mean it loads all of your news into various form elements on one page so you can edit everything at one time? Could be quite a lump of data once you get some news built up.
Some kind of SQL DB might be a good option, but don't feel like you need to use one.
Some questions:
- What is the file format? eg: one news item per line with each element separated by a pipe, comma, etc..
What I would do is write the news to one entry per line separated by a pipe and have the edit function pass the line number of the news item.
So:
1 - List all news. List page generates a dynamic link to {a href="news_edit.php?id=<?=$line?>">edit{/a} (ignore curly braces)
As the script reads the data, line by line, increment $line so we have an identifier.
2 - Edit. Edit page will only edit one news item. Store the line number (passed by the display page) as a hidden variable in the form.
3 - Save. Upon posting the data the script will read the entire file into an array and only replace slice $line-1 (arrays starting at zero) with an imploded array of the posted data.
If you have more than one file and the data needs to be related, then its probably worth using a DB (mysql or even sqlite) and some row ID's for easy linking.
It might be worth checking out how other flatfile systems are doing it. Here's a quick search of freshmeat for php CMS systems that use a flat file for storage.
freshmeat search http://freshmeat.net/projects/fancy/ - looks interesting
http://www.fusionphp.net/
^ flat file news script.
That make any sense?
-r