Skip to content Skip to sidebar Skip to footer

Use Of Php Include In Html Files

I'm having some problems on my website using some php code. My site is mainly using html and php. Instead of repeating lots of lines of script at the top of every page, i'm just u

Solution 1:

Try using this:

AddHandler x-httpd-php5-cgi .html

See here: http://httpd.apache.org/docs/2.2/mod/mod_mime.html#addhandler

Solution 2:

All you have to do is change all of the files you are including it to .php files. It will not affect them negatively just the browser will then know to interpret it the php.

All your formatting will still be valid.

Solution 3:

If you use <?php include ... ?> inside an HTML file it won't work. Reason? If the file has a .html extension, the browser will not be expecting PHP, so it won't do anything. If you have any PHP code in any file, give that file a .php extension. (Unless you have a specific reason for not doing this...?)

Post a Comment for "Use Of Php Include In Html Files"