edit page from browser

liunx

Guest
Hi,
I am trying to add the following functionality to the administration section of our web-site:
Authors will have access to these pages which allow them to modify certain content for a particular page (let's say the home-page). There is a text-line on the home-page which contains imformation which may need to be changed once in a while. I do not want to use a database field for this text-line (I have no need to return to a previous value!) and I also do not want to edit the page in code and replace the text, but I would merely want a form which contains a textbox and a submit button. When the new text is submitted, the original text-line on the home-page is replaced.
I was wondering if there is a way to have a form submition read through a file, find a particular Tag, replace it's content and save the new version by it's original name.

Any help is greatly appreciated!you want to dynamically create a page, correct? I am not sure why you would avoid using a db for this, as it would be quite easy to accomplish your task this way. In any event, your going to have to use some server side language to get there. Now, if your using server side language.....you could just add a couple of lines to hit a database. Seems a lot easier than trying to load the entire document, parse it for one field, replace the field, and save.Is there away? Not even sure I understand the question but pattern matching/replacing is something PERL does very well. You would need a small PERL script to parse the data being submitted by the form, open the file you want to change, find the pattern and replace it with the data from the form.

Another way would be to use SSI. Have the data from the form written to a file, and then use an SSI to display the file data where ever its needed.

I'm sure there are others ways using PHP or maybe even ASP if you have those capabilities.

KevinThank you both very much for your replies.
I guess my question came up because I thought using a database for such a basic text-line functionality will, in the long-run, use more overhead than replacing the string on the page. If I use a database connection to dynamically create a page, every site-user would need to use server resources, where as a simple html page will be faster.

Kevin, I have only used little Perl Script: if I replace a pattern in the original file, I assume I can also include this very pattern in the string with which I replace it. Is that correct(this would be the only way to enable future changes to the page)?

By the way, I got this idea from some web-hosts "parked site" option. If you don't pay the full hosting fee, they will park your domain name and display a basic, single page, web-presence. This page is editable, by the owner, via a Browser to display a few lines of text. I have a hard time believing they actually store this text in a database. Am I wrong in this assumption?

Thank You!I work with this method of re-writing pages on a regular basis.

Take a look at this and tell me if it's what you're looking for -- near the top of the page, left hand side, you'll find a link that allows you to change the gold colored text at the top of the page "[click to add comment]":
<!-- w --><a class="postlink" href="http://www.2bone.com/tools.shtml">www.2bone.com/tools.shtml</a><!-- w -->

If this is what you're looking for, contact me and I'll either send you a script or point you to a commercial app that makes it really easy.A databse can be a simple delimited text file, it doesn't have to be something like a mySQL server. And unless you are going to have tons of traffic and these files are going to constantly be read/written to the overhead on the server will most likely not be an issue. With most any script you could also open the actual HTML file and write the changes directly into the HTML file, this way there is no seperate DB at all.

A very simple perl script could most likely handle the task you desire.

Check out the script that 2bone mentions and see if it was you need or can use.

KevinThank you for your suggestions.
I did take a look at 2bone's link and it seems to be a cgi script (as far as I can tell), and it will probably do the trick for me.
As far as a delimited text file goes, I am not all that experienced in the details of server overhead matters, but I have always used Microsoft SQL as my database and it seems over-kill to add such a simple text alteration field to one of my tables (especially since the changes will only occur every other month). In other words, I have considered a basic text file, but not delimited. Merely for the purpose of using the 'include file' statement on whichever page required. This way I can have a form which simply overwrites the text file to be included. No parsing necessary. My question now however is, does such an 'include file' reference require more overhead than merely accessing an html file, the content of which I change via a cgi script?
I hope this makes sense.
Thanks for all your great support!
CorneliusThe short answer is yes. A webpage with SSI requires that the entire page to be parsed by the server. A regular HTML file does not require parsing. But unless the server is slow or there is lots of traffic, it might not matter either way.

KevinThe short answer is yes. A webpage with SSI requires that the entire page to be parsed by the server. A regular HTML file does not require parsing. But unless the server is slow or there is lots of traffic, it might not matter either way.
Agreed on all points, Kevin.

Back to the script...
Yes, this script does use SSI's to display the contents of a simple text file. If SSI's are an issue, or if they're not available - it's a simple matter to rewrite the HTML page with the new content - I've not included any code here, rather I've offered to discuss this with Cornelius7 away from the forum since there seems to be limited interest (here) in this type of script.ACK ! note to users of this forum...
do not walk away from your keyboard after posting a message... if you're a simpleton like me, you'll end up hitting 'refresh' and post your message twice.

and... I chose to edit the second post rather than hit 'delete' as I'm not sure if my original will also be deleted.

Sorry 'bout that folks!

ps - note to forum admins:
the private msg system has a slight flaw in the number of characters that it allows - contact me if you need the details.
 
Back
Top