If I understand correctly, you want to edit the content found in the variable created using the heredoc statement? What about storing the content in its own file, and within the script using fopen to retrieve the contents and place it in the heredoc? This way you can edit that file in your HTML editor?
Jason
http://www.easyphpwebsites.com/