Jump to content

Dead-simple View/edit Script


lazytiger

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!
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.