File Opening for Editing

reenadpatel
reenadpatel used Ask the Experts™
on
Hi,

I am creating a site builder.

I want to get help in opening any type of page having multiple frames, images or simple page. I need to open this page in a window and also get the source of the file in some variable so that i can i can change the variable data when the user is making changes in the page displayed.

Is there a standard script which works for opening any type of page and getting its data in some buffer variables for further editing and saving?

Thanks,
Reena
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
A website is a collection of files, most commonly .html or .htm files. These are actually normal text files.

If you want to edit such a file, all you need to have is a program that takes the contents of a file and puts it in a "textarea" field in a Form. Now you can edit the text in the form. On submitting the form, the text-area content needs to be saved back into the file.

Based on your request I guess you will have a solution by using file management scripts. Browse directory, open and edit file, copy file, delete file, etc.

Example of a free script here:
http://www.geocities.com/SiliconValley/Horizon/7772/webrsh.html

A more advanced script (free) here:
http://www.xav.com/scripts/genesis/   (see the demo, really good!)
Let me know if I possibly missunderstood you and you need something else!? Possibly the above is not what you meant.
Dave CrossPerl programmer, author and trainer
Commented:
You can use the Perl function "open" to open a file and the file input operator to read the data from the file. You can then open the file again (in write mode) and use "print" to write the data to the file.

If a page is made of multiple pages with frames (does anyone still use frames?) then you might need to parse the HTML looking for the names of other files to open.

Dave...
OWASP: Forgery and Phishing

Learn the techniques to avoid forgery and phishing attacks and the types of attacks an application or network may face.

Dave CrossPerl programmer, author and trainer

Commented:
reenadpatel, did you get what you wanted in answer to this question?
yes let us know,
we like to help,
but we love to solve problems all the way   :)
Top Expert 2006
Commented:
# A possible perl cgi snippet for you... works nicely for html/htm

      # open for read/write to allow flock to work on most platforms, even those with lockf(3)
      open(FILE,"+<$myhtmlfile ") || show_die("Can't open file - $!\n");
      chomp(@lines = <FILE>);
      close(FILE);

      foreach $line (@lines) {
            dowhatever();   #Display to screen? obviously @lines is the buffer
                }

#-------------------end snip---------------

It would be really helpful if you told us which language you are planning to use, as solutions can then be tailor made to your requirements.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial