Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Do HTML files using PHP Have to be saved as .php?

    This is a somewhat continuation of this thread:
    Title Bar HTML in 1 file, displayed on every webpage?

    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

  • #2
    Regular Coder
    Join Date
    Feb 2005
    Location
    West Midlands, UK
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?

  • #3
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by delinear
    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.

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    virtual()?
    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.

  • #5
    New to the CF scene
    Join Date
    Jun 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    !

    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!

  • #6
    New to the CF scene
    Join Date
    Jul 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •