I want to convert a web pages which is heavily CSS styled is written in PHP to static html so that I can embed it in an email.
I have managed to do this but for achieving this I had to convert the whole page into a string and then assign that string as email body. The layout of the page does not look as good as original as I have not been able embed CSS.
This approach has a few problems like if any changes have to be made to the layout of the page I have to redo the whole process for generating an embeddable page.
I want an easier way which will allow me to keep the original page editable in Dreamweaver visually.
You can use output buffers. If you have an html page, such as:
Then if you put, at the top of the html file:
And right at the bottom, after the last tag, put:
What this basically means is that the $string variable will end up with the entire static html of the page, after it has been dynamically generated. You can then use that string in an email. Although really, html pages don’t work exactly the same in emails, so you may want to rethink the approach.