I am trying to update my main menu in each .html file, I thought it would be easier to use a php include and edit one mainMenu file, instead of hundreds of smaller files. Is it possible to use a php include in a .html file or does it NEED to be a .php file in order for the include to work?
You need to be able to edit htaccess or your apache configuration. You would add this AddType application/x-httpd-php .php .htm .html Also, the AddType application/x-httpd-php is probably already in one of these files. If you have permission to edit it, just add the .html extension and restart apache. This will cause the server to parse all html files as php files. Make absolutely sure your html files do not have any unwanted php code in them, or it could be a security concern.
thanks, okay now I tried this but now (in FF at least) it pops up with a window that says open file with..... and gives me a choice of programs from the list... did i do something wrong?
To run PHP on a html pages you can modify your .htaccess file add this on your .htaccess file (replace "yourhtmlpage.html" with your actual html file) <Files yourhtmlpage.html> AddType application/x-httpd-php .html </Files> This .htaccess code will make the PHP executable on your html file, and not on all of your html pages. now any thing in your html that starts with <? will run as php, to overcome it you need to echo it as a string.
just run the php includes in a php file anything outside of the php tags or outputted in an echo statment will be outputted as basic html so you use you html in your php files
Php is an open source you can use HTML file in PHP easily,php is a add type application if you can to add HTML just add .HTML extension and restart the Apache.etc........
And here is a custom code that you can add to any file you want from your server. Let's say that you have a file named tutorials.html on your server, add this code to your .htaccess file: <Files tutorials.html> ForceType application/x-httpd-php </Files> This code will force your server to read the "tutorials.html" as a php file, hope that helps. -clonepal