Forum Moderators: open

Message Too Old, No Replies

calling external html files without using frames

         

xpurtwitness

4:50 am on Apr 11, 2004 (gmt 0)

10+ Year Member



I was checking out another topic related to this: [webmasterworld.com...] which had good suggestions, however I could not get the php example to work, and the object example doesn't work in Netscape. My site isn't completely Netscape-friendly yet, but I'm working to fix that. Any thoghts to include another html file without using frames?

keyplyr

8:44 am on Apr 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Providing your server supports PHP, just create an HTML file containing the content. No need for <html>, <head> or <body> tags since these are present in the main webpage. Name it: example.html (or whatever).

Then place this code where you wish the content to appear:


<?php include("example.html"); ?>

If you will be using several of these type includes, you may wish to organise them in a specific directory: /includes (or whatever). Then your code would look like:


<?php include("includes/example.html"); ?>

xpurtwitness

9:50 pm on Apr 12, 2004 (gmt 0)

10+ Year Member



Hmm. That's what I had tried. I will retrace my steps and make sure that I haven't made a typo first, before I proceed to say it doesn't work!

DrDoc

9:51 pm on Apr 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is PHP even parsing the page? By default it won't parse .html files. So, you must change your server settings to cause .html pages to be parsed by php as well, or else it won't work.

xpurtwitness

10:08 pm on Apr 12, 2004 (gmt 0)

10+ Year Member



Wow. It's amazing what a little break will do. I have been saving my main file as .html, not .php! That solved it. Thanks for your help.

keyplyr

10:11 pm on Apr 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



By default it [PHP] won't parse .html files

Ooops - that's correct.

xpurtwitness - add this line to .htaccess and you can save the file as .html and still use the PHP include.


AddHandler application/x-httpd-php .php .html