PDA

View Full Version : php embedded in .htm pages



wkenny
10-23-2005, 07:08 AM
I can get my PHP scripts running when they are in .php files.

Is it possible to embed php scripts in .htm files?

dead-poetic
10-23-2005, 06:10 PM
If you are running Apache and can use .htaccess, your in luck. Create a new .htaccess file and then in the file save the following:

# Make all PHP code look like HTML
AddType application/x-httpd-php .htm .html then you sould be able to embed php in a .html/.htm file.

wkenny
10-23-2005, 08:41 PM
Thanks for that.

I'll give it a shot

Twey
10-24-2005, 03:19 PM
Why do you want to do this?

wkenny
10-24-2005, 07:45 PM
So I won't have to change the names of all my pages and laa the links hrefs.

hasanisloe
12-05-2007, 06:18 PM
I registerd in this forum to thank you
perfect answer:)

djr33
12-05-2007, 06:43 PM
It makes sense that you would want this, but--

1. You could run a PHP script to rename all .htm files to .php if you'd like.
(Loop through all directories and rename any *.htm to *.php.)

2. If you do override the .htaccess like that, you'll make your server work a bit harder making EVERY .htm file run through the PHP parser when they don't all need to.

Anyway, it's a valid option if these aren't too discouraging.