Forum Moderators: mack

Message Too Old, No Replies

Html alternative to PHP include?

html wrapper?

         

yummybanas

8:47 pm on Apr 4, 2006 (gmt 0)

10+ Year Member



I like PHP because if all my php files have header.php included, I can make changes to that file and it will reflect on all my pages. But since static html is easier on servers, I'd like to have the same thing done with html files. How can I achieve that?

I remember seeing large interactive sites parsing static html just like a blog. I'm not too sure how to tackle this problem. All I can think of is html wrapper.

Any advice?

milanmk

9:33 pm on Apr 4, 2006 (gmt 0)

10+ Year Member



You can try using external JS file (not the exact substitute).

le_gber

11:50 am on Apr 5, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I remember seeing large interactive sites parsing static html just like a blog

yummybanas it is possible that these sites have modified their server to parse files with html as a server side script (ie the page appears to be .html but in fact there is asp/jsp/php running on it).

for html types of includes you can look up pages with an .shtml extension.

hope this helps.

vacorama

6:40 pm on Apr 5, 2006 (gmt 0)

10+ Year Member



SSI (Server Side Includes)... just make a file called 'filename.inc' with whatever html you want to include and reference it anywhere on your site with:
<!--#include virtual="filename.inc" -->

vacorama

6:44 pm on Apr 5, 2006 (gmt 0)

10+ Year Member



oh.. and any page you need use an include initially will only work with a '.shtml' extension.. but if you want to change it so you can use '.html' just create a file called '.htaccess' in your main site directory with the follwing contents:

Options +Includes
AddHandler server-parsed .shtml .html .htm

yummybanas

12:46 pm on Apr 6, 2006 (gmt 0)

10+ Year Member



You've been very helpful. Thanks a lot for contributing and pointing me out to the right direction, gber and varacoma. I'll start implementing this learning more about it.

ytswy

12:56 pm on Apr 6, 2006 (gmt 0)

10+ Year Member



The other option is to use a program like Dreamweaver - Dreamweaver uses library items which are similar in concept to server side includes: you can have files that are used on multiple pages that you only have to update in one place, but it all happens offline on your own machine, and you then upload the pages as static html.

It does mean when you update a library item, you have to re-upload all the pages that use it for the change to happen.