how to use php code in .html file?????

Started on the old forum in October 2011 · view the original in the archive · old links redirect here

8 replies · 917 views · started 15 years ago · 1 min read

6 participants
iBeyond Junior · 47 posts #2

rename the .html file to .php & use mod rewrite 🙂

or goto Cpanel>> ApacheHandlers & you'll understand what to do.

i0nutzxp Developer · 150 posts #3

Changing file extension is useless. (it only slow down your site) You can use mod rewrite for seo urls : /profile/mcdonald/photos or else is only a waste of time.

<?php unlink('World/Europe/Romania.country'); ?>
metulj Super moderator Principal · 1,726 posts #7

slowy wrote: i want to use sea html version so how to add php codes(smaato or other php ad codes) in .html file i tried adding RemoveHandler .html .htm AddType application/x-httpd-php .php .html .htm in .htaccess but its not working

it should be

AddType application/x-httpd-php .html

if you need PHP only on one *.html page, then maybe this would be better option

<Files [COLOR=#ff0000]pagename[/COLOR].html>
AddType application/x-httpd-php .html
</Files>

but keep in mind... anything in your *.html document that starts with <? will be executed as PHP now, and btw... avoid short PHP tag like irfiii has posted always use

<?php
echo 'full PHP tag';
?>

It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt. ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ ! ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.

キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

slowy Senior · 357 posts #8

metulj wrote: it should be

AddType application/x-httpd-php .html

if you need PHP only on one *.html page, then maybe this would be better option

<Files pagename.html>
AddType application/x-httpd-php .html
</Files>

but keep in mind... anything in your *.html document that starts with <? will be executed as PHP now, and btw... avoid short PHP tag like irfiii has posted always use

<?php
echo 'full PHP tag';
?>

when i try to open file then its saying to save the file instead of opening in browser

metulj Super moderator Principal · 1,726 posts #9

slowy wrote: when i try to open file then its saying to save the file instead of opening in browser

fix header...

It's better to keep your mouth shut and give the impression that you're stupid, than to open it and remove all doubt. ⓣⓗⓔ ⓠⓤⓘⓔⓣⓔⓡ ⓨⓞⓤ ⓑⓔ©ⓞⓜⓔ, ⓣⓗⓔ ⓜⓞⓡⓔ ⓨⓞⓤ ⓐⓡⓔ ⓐⓑⓛⓔ ⓣⓞ ⓗⓔⓐⓡ ! ιη тнєσяу, тнє ρяα¢тι¢є ιѕ α яєѕυℓт σƒ тнє тнєσяу, вυт ιη ρяα¢тι¢є ιѕ тнє σρρσѕιтє.

キノgんイノ刀g 4 ア乇ムc乇 ノ丂 レノズ乇 キucズノ刀g 4 √ノ尺gノ刀ノイリ!

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close