Writing to a html page
Hello. I am not sure as to hwo to do this:
i have a script which is writing to a html page which is fine. But I now want to run the script again and write to the html page again. But I don't know how to clear what was in the html page and write in the new stuff so that there will only ever be one piece of text on the page at once.
Can someone help?
------------------
Thomas Minton
The JavaScript Place
Get paid $20 - $160 an hour for viewing adverts
Ken Elliott posted this at 13:23 — 24th June 2000.
They have: 358 posts
Joined: Jun 1999
Assuming that you are writing your html file like this..
open (FILE ">>../file.html");
print FILE "the page";
close (FILE);
all you need to do to over write the old page is change ">>" to ">". The two >> mean to append to the file. Any data sent to be written to it will be added to the end of the file. The single > means to write to the file overwriting the old contents.
If you are worried about being able to keep some of the old contents I recommend using SSI to import an txt file that is created by your PERL script. That is what I do.
VulKen
Chunky Cheese??
Pimpin like a pimp with an electrofied pimpin machine!
minton posted this at 15:47 — 24th June 2000.
They have: 314 posts
Joined: Nov 1999
Hey,
Thanks Vulken. i have done what you said but I now get an internal server error in the script I added it to.
Could someone take a look at my scripts?
http://www.dotcomper.co.uk/cgi-bin/testingnews/formtohtml.txt is the script which works. This has two form fields on it. One is for a message and one is for a subject. When the subkit button is pushed it is meant to run http://www.dotcomper.co.uk/cgi-bin/testingnews/formtohtml2.pl.txt which is simply meant to take the input from the first script and write it to a html document.
I am sure that I am not making it take the info from the first script and put it into ther other but I am not sure how I get it to "remember" what was in the last one and print it in the html doc.
In short, can some of the perl gods out there take a look and see what they think it is wrong?
Thanks alot and thanks again Vulken
------------------
Thomas Minton
The JavaScript Place
Get paid $20 - $160 an hour for viewing adverts
[This message has been edited by minton (edited 24 June 2000).]
Thomas
The JavaScript Place
The JavaScript Place Forums
Ken Elliott posted this at 23:57 — 25th June 2000.
They have: 358 posts
Joined: Jun 1999
um...I used your script and it appeared to work correctly. I am not understanding the foremost problem in your script. If it is that you cannot write to an external file, be sure that the directory that your file is in is chmoded 755. You might not be able to chmod your home directory to 755 so you might have to keep your files in an upper directory that you have chmoded 755. Also make sure that the file is chmoded 755 as well.
If this is not your problem and I am WAY OFF. Just reply here and tell me a little more clearly what happens when you run your script. Also post a text version of formtohtml2.pl.
Sorry I could help anymore..
VulKen
I smell like tainted meat
Pimpin like a pimp with an electrofied pimpin machine!
minton posted this at 14:44 — 26th June 2000.
They have: 314 posts
Joined: Nov 1999
Hi Vulken,
Thanks for your help, I now have the script fully working. My problems were that I couldn't take what was written in a form and open a file to print it.... But now I have fixed it.
Thanks
------------------
Thomas Minton
The JavaScript Place
Get paid $20 - $160 an hour for viewing adverts
Thomas
The JavaScript Place
The JavaScript Place Forums
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.