Page 1 of 1

parsing php in .html

Posted: Wed Oct 27, 2010 11:33 am
by faris
Hi guys,

I have a customer who has a site with about 200 .html documents. They've asked me to make a certain adjustment that would be really easy if I could only "include" a snippet of html in each page. If they were php pages I would use use a require() and the job would be done.

I know I could rename the pages from .html to .php but this would have to be done manually for each page, letting Dreamweaver then update all the necessary links each time. It would be a serious pain in the bottom and take ages.

I was wondering if there were any bad security implications to using an apache configuration directive in the Plesk vhosts.conf or .htaccess for the site to tell it to parse .html as php as well as .php files?

The disadvantage would be that Dreamweaver probably won't play nice with php code in .html files (e.g. it won't display the included code like it will with a page ending in .php). Hmmm....

The alternative, I suppose, would be to rename all .html to .php on the server (nice and easy in Linux!), download them, then do a find and replace in Dreamweaver to change .html to .php in the source of each page. This option scares me a little as there's plenty of scope for it to all go wrong :-(

Does anybody have any other suggestions?

Re: parsing php in .html

Posted: Wed Nov 03, 2010 1:14 pm
by Highland
I've never heard of any bad implications. You'd add a tiny bit of overhead in serving up otherwise static html pages but that's it.

If they have access to your file structure, parsing html with PHP would be the least of your problems.

Re: parsing php in .html

Posted: Wed Nov 03, 2010 4:10 pm
by faris
Well, in the end I renamed everything as on top of everything else it allowed me to have both the old and the new versions running in parallel.

It was a pain but worth it.

But it is good to know that I can do it in the future if I need to :-). Thanks.

Faris.