Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

editing html file created from DomDocument

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

editing html file created from DomDocument

Postby cl2606 » Wed May 22, 2013 5:45 am

I have the following code:

Code: Select all
$dom = new DOMDocument('1.0', 'UTF-8');
   $dom->preserveWhiteSpace = true;
   libxml_use_internal_errors(true);
   $dom->loadHTML($body);
   $dom->formatOutput = true;
   
   $path = $_SERVER['DOCUMENT_ROOT'] . 'protocol/' . $filename;

   
   return $dom->saveHTMLFile($path);


Everything works fine. It saves the file, it displays the file just fine. However, if I open up the created html file in any editor I cannot edit it and re-save it. The only way I can make changes is to copy the Select All, copy and paste into a new document and save it.

What am I doing wrong/missing to allow me to edit the file?

Thanks
cl2606
New php-forum User
New php-forum User
 
Posts: 4
Joined: Wed May 22, 2013 5:40 am

Re: editing html file created from DomDocument

Postby johnj » Wed May 22, 2013 9:49 pm

you should have write access to the new file to edit. Please check the permission of the newly created file.
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: editing html file created from DomDocument

Postby cl2606 » Mon May 27, 2013 5:44 am

I have full permissions. I'm not sure what is going on. If I copy and paste to a new document it all works fine.
cl2606
New php-forum User
New php-forum User
 
Posts: 4
Joined: Wed May 22, 2013 5:40 am

Re: editing html file created from DomDocument

Postby johnj » Mon May 27, 2013 6:29 am

are you logged in as admin?
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: editing html file created from DomDocument

Postby cl2606 » Tue May 28, 2013 4:19 am

Yep!
cl2606
New php-forum User
New php-forum User
 
Posts: 4
Joined: Wed May 22, 2013 5:40 am

Re: editing html file created from DomDocument

Postby cl2606 » Tue May 28, 2013 7:17 am

Here is the error I get (I'm using Notepad++, but I can't save it using regular Notepad or anything else). I've added the dialog box as an attachment, I'm not sure how I'm supposed to add an image to this text.

Anyways, I moved my file to another directory and was able to edit and save the file. I then moved it back to the original directory and again I was able to edit and save it.

I appreciate the help thus far. This is an annoying little problem.
Attachments
save_failed.png
save_failed.png (20.97 KiB) Viewed 320 times
cl2606
New php-forum User
New php-forum User
 
Posts: 4
Joined: Wed May 22, 2013 5:40 am


Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot], Google Feedfetcher and 7 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.