Jump to content

Archived

This topic is now archived and is closed to further replies.

lazytiger

Dead-simple View/edit Script

Recommended Posts

I'm a PHP newbie, and I'm trying to roll my own simple webpage editor based on the following idea:

You have a webpage constructed with a template handling the common parts (header, footer, menu) and it calls in a separate file with the content. The content is called based on what is asked for in the URL, i.e., "whatever.com/intro" displays the template and pulls in a file called "intro". On this page is an "edit" link, which replaces the normal content with an editable text box containing the content. Hit "save" and you are taken back to the updated view-only content.

Simple enough, but I don't want to use a database. I've already cobbled together a simple CMS that pulls in content from MySQL, and it seems like overkill. Why not just store the content in plain old text files, one per page? I have not been able to find a tutorial DOESN'T use a database to do what I described above. It seems like it should be so simple that I'm getting extremely frustrated that I can't find an example script to learn from. I know enough PHP that I could make it work with a good example to start from, but I haven't a clue how to start it from scratch.

Obviously, this is highly insecure. The next step would be to wrap the editing into a logged-in session.

Please let me know if you know of any scripts that I could start from, or if you could give me a few clues about how to write it from scratch. Thank you!

Share this post


Link to post
Share on other sites
[!--quoteo(post=388688:date=Jun 27 2006, 05:35 PM:name=lazytiger)--][div class=\'quotetop\']QUOTE(lazytiger @ Jun 27 2006, 05:35 PM) [snapback]388688[/snapback][/div][div class=\'quotemain\'][!--quotec--]I have not been able to find a tutorial DOESN'T use a database to do what I described above. [/quote]
You know, I had this problem before, and most of people just love MySQL for some reason and will resort to it for the simplest of the scripts.

But anyway, it's not hard to use flat files. I am used to:

1. Put these files in a folder, and have it secured with .htaccess (denying public access)
2. Use a combination of serializer and file handling functions to handle them.

[a href=\"http://www.php.net/serialize\" target=\"_blank\"]http://www.php.net/serialize[/a]
[a href=\"http://www.php.net/fopen\" target=\"_blank\"]http://www.php.net/fopen[/a]

I am a bit lazy to tell you the details; but I hope you can figure it out.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.