Forum Moderators: open

Message Too Old, No Replies

Including PHP code in .html page

         

raj1094

9:19 am on Jul 2, 2009 (gmt 0)

10+ Year Member



Hi,

Can we include the "php code" in ".html pages".

My query is I have 300 html pages, Now I want to change the header and Footer sections of my pages, will it be possible paste a "php code" in both the sections so that in future if I want to make any further changes it will be easy for me to modify from one location, which effects in all pages.

tedster

9:42 am on Jul 2, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes - with the right server configuration you can parse .html files as php. There are many many threads about it in our Apache Web Server forum [webmasterworld.com]. If you uise our Site Search [webmasterworld.com] I think you'll find the help you need already posted.

g1smd

6:53 pm on Jul 2, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Yes. Change the configuration so that .html files are parsed for PHP content.

Do *not* be tempted to change any of the URLs, even the extension, for your pages.

Jonesy

3:53 pm on Jul 3, 2009 (gmt 0)

10+ Year Member Top Contributors Of The Month



Yes, you can include php in html -- by using Server Side Includes (SSI).
e.g.:

<!--#include virtual="example.php" -->

I use this method to randomized images on some pages, and to aggregate text and images from 'foreign' web sources on others of my pages.

Your web server must be configured for SSI.

This eliminates the overhead of having all your html pages being processed by the php interpreter.