Forum Moderators: coopster

Message Too Old, No Replies

Question about php includes in an html file

         

Johndh

9:40 am on Aug 20, 2012 (gmt 0)

10+ Year Member



I don't actually have a problem, but i'm not sure why not?

I used php includes to add a footer and top menu on all my pages, so that I can change them easily. I was expecting that i would then have to change all the .html files to .php, but i didnt. It works fine and its very handy to still be able to check new content locally on the html file before uploading(although without the includes).

Did i just get lucky or does this always work like that?

cheers

john

phranque

10:01 am on Aug 20, 2012 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld, Johndh!

assuming it's an apache server this can be specified using either the AddType or AddHandler directive, depending on your specific configuration.

not2easy

1:39 pm on Aug 20, 2012 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



It sounds like your host had already set up the server to handle it that way, not all hosts do so it is a matter of chance to try it and find it working without needing tweaks. I have seen hosts set up where it cannot work, but not recently.

lucy24

5:22 pm on Aug 20, 2012 (gmt 0)

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



its very handy to still be able to check new content locally on the html file before uploading(although without the includes)

Go get a pseudo-server like MAMP or WAMP. The basic version is free. It will make your local files behave just like the "live" ones, including oops any includes. And other good stuff like /site-absolute links (leading slash) and directory/ names (trailing slash).