Hello all, I need to place a small php code in html page. How can I make it working? I have tried putting up a .htaccess file with the following lines in it AddType application/x-httpd-php .php .htm .html PHP: and AddType application/x-httpd-php .html AddType application/x-httpd-php .htm PHP: But, none of them are working. Is there any way out?
Hmm. Wouldn't it be easier to put html code into .php file and then rewrite the file to .html with mod rewrite?
Thanks guys for your responses.. Anyway, I have managed to do it by calling the php file in virtual mode. heres the code I used. <!--#include virtual="/filename.php" --> HTML:
Hello, Another way in which you could have done this was by editing the php.ini file in your server root to add the .html or .htm as a file to also be parsed by the PHP interpreter. But I see you have fixed the problem, congrats!
That is a SSI directive. Weird that would work on pages that end in .html and not .shtml At any rate, I have had the same problem as you before. Cannot explain why, but you could have tried ONE of the following until it works: AddHandler x-httpd-php5 .shtml .html .htm AddHandler application/x-php .shtml .html .htm AddType x-mapp-php5 .shtml .html .htm AddType application/x-httpd-php .shtml .html .htm Code (markup): I have used either one of these, depending on what server I am on and what version of php is running.
I am using the following for that setup: AddHandler x-httpd-php5 .php .htm .html Code (markup): I added the .php for good measure. Probably not needed. If you have any .shtml pages, add that extension to the list. This is the same directive I use to process Blogger FTP published pages to my server. It has cut down on transfer time immensely when I cut out everything above/below the posts and used include statements. With over 500 posts, it is getting quite large!
Hi, This is Srinivas Sr. SEO, you rise question is very populated in shat time, in my opinion is you do all those thing php in dream wear and save as in html page. For example index.php is there you want change it index.html, you save as a index.php page to index.html. Because You didn't modify php code into html code.
Isn't it weird that you have to put PHP in HTML page ? HTML is for non-dynamic page isn't it ? Could you tell me why you needed doing HTML better than PHP file ? Kéké : (please excuse my english as it is a foreign language to me)
Keke, There are two reasons for processing php script inside of a page that ends in .html It used to be that .html pages were considered static. Some genius, don't know who, figured out that you could instruct the server to process those pages as if they were .php pages. It was also mistakingly believed that static pages would garner better SERPs, a myth that propagates thru forums and blogs even today. The main reason for doing this is to ease site maintenance. You can now "include" other files within your .html pages, such as the start of a page (head) and the end of the page (tail). These areas are usually the same from page to page and now can be maintained in a single file for each section.
Oki, I didn't heard about that myth ... Thas good indeed for me, as I prefered spending my time on writting more intersting information on my pages than spending time looking for that kind of technics. I'm using that include things for Meta data such as the last revision time, language, and other basic information. Thanks a lot for answering me so quickly and in a way I can understand ^^. have a good day. kéké
I make all my sites with a php extension even if I don't use any on the page. Just incase you need to come back and add something requiring PHP