...

View Full Version : Do HTML files using PHP Have to be saved as .php?



david14259
06-27-2005, 05:44 PM
This is a somewhat continuation of this thread:
http://www.codingforums.com/showthread.php?t=62209

I want to use the PHP tag "Include" in my web pages to include a title bar on every page. (while the code for the title bar remains in 1 html file).

However, it appears I have to save the webpages as .php files to get the "Include" tag to work. This presents a problem for my website because I need to have some webpages saved as .jsp files.

So, my question is, how can I use the PHP command "Include" in files that are not saved as .php?

Thanks!
David

delinear
06-27-2005, 05:59 PM
You can have your server set up to parse .htm files (or any file for that matter) as PHP files, however, that will probably (not 100% sure when it comes to .jsp) cause problems with the jsp files parsing. Have you looked at something like server side includes?

david14259
06-27-2005, 06:01 PM
Have you looked at something like server side includes?

I'm looking for SSI now, although I seem to only be finding some rather advanced info (aka "gibberish") on it. I'll keep looking though, thanks for the help.

Fou-Lu
06-27-2005, 06:30 PM
virtual() (http://ca3.php.net/manual/en/function.virtual.php)?
This is the first I've heard of include() not working on an .html file. I'm sure I've used it in the past before with no errors...
If neither work, we'll look into using file() or its counterparts.

david14259
06-27-2005, 08:38 PM
Thanks for the info, I've got the SSI working. Had to configure several things on our server for it to work.

Have a nice day!

ManagedLinks
07-05-2005, 03:29 AM
you can configure apache to execute any file as a PHP file

I commonly change my .htaccess to allow execution of html files as php
that way an entire site can be changed without the need to reconfigure every link, especially when considering external links.

the details are here...
making html work like php (http://www.managedlinks.com/htaccess.html)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum